Merge branch 'dev_TPI' of https://bdgit.trustie.net/hushasha/bigdata into dev_TPI
This commit is contained in:
commit
4f6e97bea4
|
|
@ -183,22 +183,6 @@
|
|||
nAjaxLoading.hide();
|
||||
nInfoAjaxLoading.hide();
|
||||
// test_sets 公开测,hide_test_sets 隐藏测试集
|
||||
|
||||
/* var html = bt('t:exec_results_1',{
|
||||
"test_sets": eval('[' + data.test_sets + ']'),
|
||||
had_test_count: data.had_test_count,
|
||||
test_sets_count: data.test_sets_count,
|
||||
had_passed_testsests_error_count: data.had_passed_testsests_error_count,
|
||||
test_sets_hidden_count: data.test_sets_hidden_count,
|
||||
test_sets_public_count: data.test_sets_public_count,
|
||||
had_passed_testsests_hidden_count: data.had_passed_testsests_hidden_count,
|
||||
had_passed_testsests_public_count: data.had_passed_testsests_public_count,
|
||||
final_score: data.final_score,
|
||||
latest_output: data.latest_output,
|
||||
language: data.language
|
||||
});
|
||||
$("#game_test_set_results").html(html);
|
||||
$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面*/
|
||||
code_evaluation(
|
||||
eval('[' + data.test_sets + ']'),
|
||||
data.had_test_count,
|
||||
|
|
|
|||
|
|
@ -4,52 +4,38 @@
|
|||
</style>
|
||||
|
||||
<form action="<%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>" method="post" id="file_update_id" data-remote="true">
|
||||
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
|
||||
<textarea class="" id="challenge-answer-edit-small" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||
</li>
|
||||
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
|
||||
<textarea class="" id="challenge-answer-edit-small" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||
</li>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
// 自动完成
|
||||
// 自动完成
|
||||
var codeContents = $("#challenge-answer-edit-small").val(); // 获取版本库代码内容
|
||||
var changeCode = codeContents;// 修改代码的内容(初始化时,与版本库代码一致,便于判断)
|
||||
$(function(){
|
||||
loading = $("#ajax-indicator").children('span')[0]; // 加载中的html
|
||||
});
|
||||
var editor_CodeMirror = CodeMirror.fromTextArea(document.getElementById("challenge-answer-edit-small"), {
|
||||
/* mode: {name: "text/x-c++src",
|
||||
// version: 2,
|
||||
singleLineStringErrors: false},*/ // 目前补全js是引入的javascript-hint,因此目前不能指定语言
|
||||
lineNumbers: true,
|
||||
theme: "railscasts",
|
||||
// extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
|
||||
indentUnit: 4, //代码缩进为一个tab的距离
|
||||
matchBrackets: true,
|
||||
autoRefresh: true,
|
||||
smartIndent: true,//智能换行
|
||||
extraKeys: {"Ctrl-Q": "autocomplete"},
|
||||
autofocus: true,
|
||||
styleActiveLine: true,
|
||||
lint: true,
|
||||
gutters: ["CodeMirror-linenumbers", "breakpoints"]
|
||||
});
|
||||
|
||||
var editor_CodeMirror = CodeMirror_fromTextArea("challenge-answer-edit-small");
|
||||
|
||||
editor_CodeMirror.on('change', function(cMirror){
|
||||
// get value right from instance
|
||||
$('#challenge-answer-edit-small').val(cMirror.getValue());
|
||||
changeCode = cMirror.getValue(); // 获取修改后的代码
|
||||
<% if @myshixun.shixun.language == "Html" %>
|
||||
tpi_html_show();
|
||||
tpi_html_show();
|
||||
<% end %>
|
||||
});
|
||||
|
||||
/* // 使用cursorActivity事件也能判断活动行,但是执行添加代码后,会执行活动行样式,会吧添加的代码重新生成。
|
||||
$(".CodeMirror-code").click(function(){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
});*/
|
||||
/* // 使用cursorActivity事件也能判断活动行,但是执行添加代码后,会执行活动行样式,会吧添加的代码重新生成。
|
||||
$(".CodeMirror-code").click(function(){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
});*/
|
||||
|
||||
editor_CodeMirror.setCursor(12, 0);
|
||||
editor_CodeMirror.setCursor(12, 0);
|
||||
|
||||
// 每10秒钟保存一次
|
||||
editor_CodeMirror.on('focus',function(cMirror){
|
||||
|
|
@ -75,107 +61,107 @@
|
|||
clearInterval(sh);
|
||||
});
|
||||
|
||||
// 以下情景用于剔除自动补全功能(下面键盘事件,讲不触发自动补全功能)
|
||||
var ExcludedIntelliSenseTriggerKeys =
|
||||
{
|
||||
"8": "backspace",
|
||||
"9": "tab",
|
||||
"13": "enter",
|
||||
"16": "shift",
|
||||
"17": "ctrl",
|
||||
"18": "alt",
|
||||
"19": "pause",
|
||||
"20": "capslock",
|
||||
"27": "escape",
|
||||
"32": "space",
|
||||
"33": "pageup",
|
||||
"34": "pagedown",
|
||||
"35": "end",
|
||||
"36": "home",
|
||||
"37": "left",
|
||||
"38": "up",
|
||||
"39": "right",
|
||||
"40": "down",
|
||||
"45": "insert",
|
||||
"46": "delete",
|
||||
"59": ";",
|
||||
"91": "left window key",
|
||||
"92": "right window key",
|
||||
"93": "select",
|
||||
"107": "add",
|
||||
"109": "subtract",
|
||||
"110": "decimal point",
|
||||
"111": "divide",
|
||||
"112": "f1",
|
||||
"113": "f2",
|
||||
"114": "f3",
|
||||
"115": "f4",
|
||||
"116": "f5",
|
||||
"117": "f6",
|
||||
"118": "f7",
|
||||
"119": "f8",
|
||||
"120": "f9",
|
||||
"121": "f10",
|
||||
"122": "f11",
|
||||
"123": "f12",
|
||||
"144": "numlock",
|
||||
"145": "scrolllock",
|
||||
"186": "semicolon",
|
||||
"187": "equalsign",
|
||||
"188": "comma",
|
||||
"189": "dash",
|
||||
"190": "period",
|
||||
"191": "slash",
|
||||
"192": "graveaccent",
|
||||
"220": "backslash",
|
||||
"222": "quote"
|
||||
};
|
||||
// 以下情景用于剔除自动补全功能(下面键盘事件,讲不触发自动补全功能)
|
||||
var ExcludedIntelliSenseTriggerKeys =
|
||||
{
|
||||
"8": "backspace",
|
||||
"9": "tab",
|
||||
"13": "enter",
|
||||
"16": "shift",
|
||||
"17": "ctrl",
|
||||
"18": "alt",
|
||||
"19": "pause",
|
||||
"20": "capslock",
|
||||
"27": "escape",
|
||||
"32": "space",
|
||||
"33": "pageup",
|
||||
"34": "pagedown",
|
||||
"35": "end",
|
||||
"36": "home",
|
||||
"37": "left",
|
||||
"38": "up",
|
||||
"39": "right",
|
||||
"40": "down",
|
||||
"45": "insert",
|
||||
"46": "delete",
|
||||
"59": ";",
|
||||
"91": "left window key",
|
||||
"92": "right window key",
|
||||
"93": "select",
|
||||
"107": "add",
|
||||
"109": "subtract",
|
||||
"110": "decimal point",
|
||||
"111": "divide",
|
||||
"112": "f1",
|
||||
"113": "f2",
|
||||
"114": "f3",
|
||||
"115": "f4",
|
||||
"116": "f5",
|
||||
"117": "f6",
|
||||
"118": "f7",
|
||||
"119": "f8",
|
||||
"120": "f9",
|
||||
"121": "f10",
|
||||
"122": "f11",
|
||||
"123": "f12",
|
||||
"144": "numlock",
|
||||
"145": "scrolllock",
|
||||
"186": "semicolon",
|
||||
"187": "equalsign",
|
||||
"188": "comma",
|
||||
"189": "dash",
|
||||
"190": "period",
|
||||
"191": "slash",
|
||||
"192": "graveaccent",
|
||||
"220": "backslash",
|
||||
"222": "quote"
|
||||
};
|
||||
|
||||
// codemmirror键盘按下事件,用来触发自动补全代码功能
|
||||
editor_CodeMirror.on("keyup", function(editor, event)
|
||||
{
|
||||
var __Cursor = editor.getDoc().getCursor();
|
||||
var __Token = editor.getTokenAt(__Cursor);
|
||||
/* // 当前行变化时,codemirror的js会改变gutter的结构,因此要在此需要再增加标示
|
||||
if(event.keyCode == 38 || event.keyCode == 40){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
}*/
|
||||
console.log("####################################");
|
||||
console.log(__Token);
|
||||
if (!editor.state.completionActive &&
|
||||
!ExcludedIntelliSenseTriggerKeys[(event.keyCode || event.which).toString()])
|
||||
{
|
||||
// 中文编码的( 与 { 对于键盘事件是相同的,所以需要再判断
|
||||
if(event.shiftKey && event.keyCode == 57){
|
||||
if(__Token.string == '('){
|
||||
editor.replaceSelection(")"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch); // 设置光标位置在输入(之后
|
||||
return; // 输入的是"(" 不启动补全功能
|
||||
}
|
||||
}else if(event.shiftKey && event.keyCode == 219){
|
||||
if(__Token.string == '{'){
|
||||
editor.replaceSelection("}"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch);// 设置光标位置在输入{之后
|
||||
return; // 输入的是"{" 不启动补全功能
|
||||
}
|
||||
}else if(__Token.string.match(/^[\u4e00-\u9fa5]+$/)){
|
||||
return; // 输入的是中文,也不启动自动补全功能
|
||||
}else if(event.shiftKey && event.keyCode == 51){
|
||||
return;
|
||||
}else if(__Token.string.indexOf("#") > -1 || __Token.type == null){
|
||||
return;
|
||||
}else if(event.ctrlKey){
|
||||
return;
|
||||
}
|
||||
if((event.keyCode >= 65) && (event.keyCode <= 90)){
|
||||
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); // 开启自动补全
|
||||
}
|
||||
}
|
||||
});
|
||||
// codemmirror键盘按下事件,用来触发自动补全代码功能
|
||||
editor_CodeMirror.on("keyup", function(editor, event)
|
||||
{
|
||||
var __Cursor = editor.getDoc().getCursor();
|
||||
var __Token = editor.getTokenAt(__Cursor);
|
||||
/* // 当前行变化时,codemirror的js会改变gutter的结构,因此要在此需要再增加标示
|
||||
if(event.keyCode == 38 || event.keyCode == 40){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
}*/
|
||||
console.log("####################################");
|
||||
console.log(__Token);
|
||||
if (!editor.state.completionActive &&
|
||||
!ExcludedIntelliSenseTriggerKeys[(event.keyCode || event.which).toString()])
|
||||
{
|
||||
// 中文编码的( 与 { 对于键盘事件是相同的,所以需要再判断
|
||||
if(event.shiftKey && event.keyCode == 57){
|
||||
if(__Token.string == '('){
|
||||
editor.replaceSelection(")"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch); // 设置光标位置在输入(之后
|
||||
return; // 输入的是"(" 不启动补全功能
|
||||
}
|
||||
}else if(event.shiftKey && event.keyCode == 219){
|
||||
if(__Token.string == '{'){
|
||||
editor.replaceSelection("}"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch);// 设置光标位置在输入{之后
|
||||
return; // 输入的是"{" 不启动补全功能
|
||||
}
|
||||
}else if(__Token.string.match(/^[\u4e00-\u9fa5]+$/)){
|
||||
return; // 输入的是中文,也不启动自动补全功能
|
||||
}else if(event.shiftKey && event.keyCode == 51){
|
||||
return;
|
||||
}else if(__Token.string.indexOf("#") > -1 || __Token.type == null){
|
||||
return;
|
||||
}else if(event.ctrlKey){
|
||||
return;
|
||||
}
|
||||
if((event.keyCode >= 65) && (event.keyCode <= 90)){
|
||||
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); // 开启自动补全
|
||||
}
|
||||
}
|
||||
});
|
||||
// 设置版本库字体间距
|
||||
// $("#challenge-answer-edit-small" ).nextAll(".CodeMirror").css("line-height", 1.2);
|
||||
// $("#challenge-answer-edit-small" ).nextAll(".CodeMirror").css("line-height", 1.2);
|
||||
$(document).ready(function(){
|
||||
// 设置codemirror的高度/宽度自适应
|
||||
editor_CodeMirror.setSize("auto","auto");
|
||||
|
|
@ -184,17 +170,17 @@
|
|||
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
|
||||
});
|
||||
// 由于codemirror加载过慢,放在ready中的refresh失效,所以该在页面加载完成之后触发refresh函数
|
||||
$(window).load(function() {
|
||||
editor_CodeMirror.refresh();
|
||||
/* editor_CodeMirror.setCursor(12, 0);
|
||||
var info = editor_CodeMirror.lineInfo(12);
|
||||
editor_CodeMirror.setGutterMarker(12, "breakpoints", info.gutterMarkers ? null : makeMarker());
|
||||
function makeMarker() {
|
||||
var marker = document.createElement("div");
|
||||
marker.style.color = "#fff";
|
||||
marker.innerHTML = "<i class='fa fa-arrow-right' style='left: -30px;position: absolute;' aria-hidden='true'></i>";
|
||||
return marker;
|
||||
}*/
|
||||
});
|
||||
// 由于codemirror加载过慢,放在ready中的refresh失效,所以该在页面加载完成之后触发refresh函数
|
||||
$(window).load(function() {
|
||||
editor_CodeMirror.refresh();
|
||||
/* editor_CodeMirror.setCursor(12, 0);
|
||||
var info = editor_CodeMirror.lineInfo(12);
|
||||
editor_CodeMirror.setGutterMarker(12, "breakpoints", info.gutterMarkers ? null : makeMarker());
|
||||
function makeMarker() {
|
||||
var marker = document.createElement("div");
|
||||
marker.style.color = "#fff";
|
||||
marker.innerHTML = "<i class='fa fa-arrow-right' style='left: -30px;position: absolute;' aria-hidden='true'></i>";
|
||||
return marker;
|
||||
}*/
|
||||
});
|
||||
</script>
|
||||
|
|
@ -68,10 +68,10 @@
|
|||
<%= render :partial => "games/shixun_comment_block" %>
|
||||
<li class="fl mt10 ml15"><a href="javascript:void(0);" onclick="send_dis_to_shixun()" class="course-bth-blue color_white">发送</a></li>
|
||||
<li class="fl ml20 mt15">
|
||||
<span title="<%= @praise.nil? ? "点赞" : "取消点赞" %>" onclick="game_praise()" id="game_praise_tread" class="pt5 color-grey mr20">
|
||||
<span title="<%= @praise.nil? ? "点赞" : "取消点赞" %>" onclick="game_praise('<%= @game_challenge.id %>', '<%= @game_challenge.class %>')" id="game_praise_tread" class="pt5 color-grey mr20">
|
||||
<i class="fa fa-thumbs-up font-20 mr3 <%= @praise.nil? ? "" : "color-light-green" %>" alt="赞" ></i><span class="font-12 font-bd" id="game_praise_count"><%= @praise_count %></span>
|
||||
</span>
|
||||
<span title="<%= @tread.nil? ? "踩" : "取消踩" %>" onclick="game_tread()" id="game_tread" class="color-grey" style="padding-top:7px;">
|
||||
<span title="<%= @tread.nil? ? "踩" : "取消踩" %>" onclick="game_tread('<%= @game_challenge.id %>')" id="game_tread" class="color-grey" style="padding-top:7px;">
|
||||
<i class="fa fa-thumbs-down font-20 mr3 <%= @tread.nil? ? "" : "color-orange" %>" ></i><span class="font-12 font-bd" id="game_tread_count"><%= @tread_count %></span>
|
||||
</span>
|
||||
</li>
|
||||
|
|
@ -129,56 +129,4 @@
|
|||
// 点赞/取消点赞功能
|
||||
var praiseStatus = <%= @praise.nil? ? false : true %>; // 是否点赞
|
||||
var treadStatus = <%= @tread.nil? ? false : true %>; // 是否踩
|
||||
var h = true;
|
||||
function game_praise(){
|
||||
if(treadStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '<%= praise_tread_praise_plus_path({:obj_id => @game_challenge.id, :obj_type => @game_challenge.class}) %>',
|
||||
data: {horizontal: h, game_praise: true},
|
||||
success:function(data){
|
||||
h = !h;
|
||||
var praise_count = $("#game_praise_count");
|
||||
if(data.praise){
|
||||
praiseStatus = true; //已赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").addClass("color-light-green");
|
||||
$("#game_praise_tread").attr("title", "取消点赞")
|
||||
}else{
|
||||
praiseStatus = false; //取消赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").removeClass("color-light-green");
|
||||
$("#game_praise_tread").attr("title", "点赞")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 踩/取消踩功能
|
||||
var d = true;
|
||||
function game_tread(){
|
||||
if(praiseStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '<%= praise_tread_praise_plus_path({:obj_id => @game_challenge.id, :obj_type => "ChallengeTread"}) %>',
|
||||
data: {horizontal: d, game_praise: true},
|
||||
success:function(data){
|
||||
d = !d;
|
||||
var tread_count = $("#game_tread_count");
|
||||
if(data.praise){
|
||||
treadStatus = true; // 取消踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").addClass("color-orange");
|
||||
$("#game_tread").attr("title", "取消踩")
|
||||
}else{
|
||||
treadStatus = false; // 已踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").removeClass("color-orange");
|
||||
$("#game_tread").attr("title", "踩");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
@ -19,53 +19,4 @@
|
|||
notice_sure_box("实训更新啦,系统已自动为您重置");
|
||||
<% end %>
|
||||
});
|
||||
var control = 0; // 版本库控制 0表示点击放大 1表示点击缩小
|
||||
var control_1 = 0; // 测评控制 0表示点击放大 1表示点击缩小
|
||||
var nGameRes = $("#games_repository_contents"); // 版本库区域
|
||||
var nGameEva = $("#games_valuation_contents"); // 评测区域
|
||||
var nRIcon = $("#extend_and_zoom").children("i"); // 版本库放大缩小按钮
|
||||
var nCode = $("#file_entry_content").find(".CodeMirror-scroll"); // 版本库代码区域
|
||||
var nVIcon = $("#valuation_extend_and_zoom").children("i"); // 评测放大缩小
|
||||
var nMove = $(".h-center");
|
||||
|
||||
/* --------------------------------版本库的放大与缩小---------------------------------------------*/
|
||||
function repository_extend_and_zoom(){
|
||||
if(control == 0){
|
||||
nGameRes.addClass("-flex-basic100");
|
||||
nGameEva.addClass("-flex-basic0");
|
||||
nRIcon.addClass("fa-compress");
|
||||
nRIcon.removeClass("fa-arrows-alt");
|
||||
nMove.hide();
|
||||
control = 1;
|
||||
}else if(control == 1){
|
||||
nGameRes.removeClass("-flex-basic100");
|
||||
nGameEva.removeClass("-flex-basic0");
|
||||
nRIcon.removeClass("fa-compress");
|
||||
nRIcon.addClass("fa-arrows-alt");
|
||||
nMove.show();
|
||||
control = 0;
|
||||
}
|
||||
editor_CodeMirror.setSize("auto", "auto");
|
||||
var h = nGameRes.height() - $("#top_repository").height() - 50;
|
||||
nCode.css("min-height", h);
|
||||
}
|
||||
|
||||
/* --------------------------------测评的扩大与缩小---------------------------------------------*/
|
||||
function valuation_extend_and_zoom(){
|
||||
if(control_1 == 0){
|
||||
nGameRes.addClass("-flex-basic0");
|
||||
nGameEva.addClass("-flex-basic100");
|
||||
nVIcon.removeClass("fa-expand");
|
||||
nVIcon.addClass("fa-compress");
|
||||
nMove.hide();
|
||||
control_1 = 1;
|
||||
}else if(control_1 == 1){
|
||||
nGameRes.removeClass("-flex-basic0");
|
||||
nGameEva.removeClass("-flex-basic100");
|
||||
nVIcon.addClass("fa-expand");
|
||||
nVIcon.removeClass("fa-compress");
|
||||
nMove.show();
|
||||
control_1 = 0;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -217,6 +217,137 @@ function toggle_test_case(t_case, id){
|
|||
}
|
||||
// end
|
||||
|
||||
// codemirror渲染textarea
|
||||
function CodeMirror_fromTextArea(id){
|
||||
var Code = CodeMirror.fromTextArea(document.getElementById(id), {
|
||||
/* mode: {name: "text/x-c++src",
|
||||
// version: 2,
|
||||
singleLineStringErrors: false},*/ // 目前补全js是引入的javascript-hint,因此目前不能指定语言
|
||||
lineNumbers: true,
|
||||
theme: "railscasts",
|
||||
// extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
|
||||
indentUnit: 4, //代码缩进为一个tab的距离
|
||||
matchBrackets: true,
|
||||
autoRefresh: true,
|
||||
smartIndent: true,//智能换行
|
||||
extraKeys: {"Ctrl-Q": "autocomplete"},
|
||||
autofocus: true,
|
||||
styleActiveLine: true,
|
||||
lint: true,
|
||||
gutters: ["CodeMirror-linenumbers", "breakpoints"]
|
||||
});
|
||||
return Code;
|
||||
}
|
||||
// end
|
||||
|
||||
var control = 0; // 版本库控制 0表示点击放大 1表示点击缩小
|
||||
var control_1 = 0; // 测评控制 0表示点击放大 1表示点击缩小
|
||||
// 版本库的放大与缩小
|
||||
function repository_extend_and_zoom(){
|
||||
var nGameRes = $("#games_repository_contents"); // 版本库区域
|
||||
var nGameEva = $("#games_valuation_contents"); // 评测区域
|
||||
var nRIcon = $("#extend_and_zoom").children("i"); // 版本库放大缩小按钮
|
||||
var nCode = $("#file_entry_content").find(".CodeMirror-scroll"); // 版本库代码区域
|
||||
var nMove = $(".h-center");
|
||||
if(control == 0){
|
||||
nGameRes.addClass("-flex-basic100");
|
||||
nGameEva.addClass("-flex-basic0");
|
||||
nRIcon.addClass("fa-compress");
|
||||
nRIcon.removeClass("fa-arrows-alt");
|
||||
nMove.hide();
|
||||
control = 1;
|
||||
}else if(control == 1){
|
||||
nGameRes.removeClass("-flex-basic100");
|
||||
nGameEva.removeClass("-flex-basic0");
|
||||
nRIcon.removeClass("fa-compress");
|
||||
nRIcon.addClass("fa-arrows-alt");
|
||||
nMove.show();
|
||||
control = 0;
|
||||
}
|
||||
editor_CodeMirror.setSize("auto", "auto");
|
||||
var h = nGameRes.height() - $("#top_repository").height() - 50;
|
||||
nCode.css("min-height", h);
|
||||
}
|
||||
// end
|
||||
|
||||
// 测评的扩大与缩小
|
||||
function valuation_extend_and_zoom(){
|
||||
var nGameRes = $("#games_repository_contents"); // 版本库区域
|
||||
var nGameEva = $("#games_valuation_contents"); // 评测区域
|
||||
var nVIcon = $("#valuation_extend_and_zoom").children("i"); // 评测放大缩小
|
||||
var nMove = $(".h-center");
|
||||
if(control_1 == 0){
|
||||
nGameRes.addClass("-flex-basic0");
|
||||
nGameEva.addClass("-flex-basic100");
|
||||
nVIcon.removeClass("fa-expand");
|
||||
nVIcon.addClass("fa-compress");
|
||||
nMove.hide();
|
||||
control_1 = 1;
|
||||
}else if(control_1 == 1){
|
||||
nGameRes.removeClass("-flex-basic0");
|
||||
nGameEva.removeClass("-flex-basic100");
|
||||
nVIcon.addClass("fa-expand");
|
||||
nVIcon.removeClass("fa-compress");
|
||||
nMove.show();
|
||||
control_1 = 0;
|
||||
}
|
||||
}
|
||||
// end
|
||||
|
||||
// 点赞与取消点赞
|
||||
var h = true;
|
||||
function game_praise(obj_id, obj_type){
|
||||
if(treadStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: "/praise_tread/praise_plus?obj_id=" + obj_id + "&obj_type=" + obj_type,
|
||||
data: {horizontal: h, game_praise: true},
|
||||
success:function(data){
|
||||
h = !h;
|
||||
var praise_count = $("#game_praise_count");
|
||||
if(data.praise){
|
||||
praiseStatus = true; //已赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").addClass("color-light-green");
|
||||
$("#game_praise_tread").attr("title", "取消点赞")
|
||||
}else{
|
||||
praiseStatus = false; //取消赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").removeClass("color-light-green");
|
||||
$("#game_praise_tread").attr("title", "点赞")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 踩/取消踩功能
|
||||
var d = true;
|
||||
function game_tread(obj_id){
|
||||
if(praiseStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: "/praise_tread/praise_plus?obj_id=" + obj_id + "&obj_type=ChallengeTread",
|
||||
data: {horizontal: d, game_praise: true},
|
||||
success:function(data){
|
||||
d = !d;
|
||||
var tread_count = $("#game_tread_count");
|
||||
if(data.praise){
|
||||
treadStatus = true; // 取消踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").addClass("color-orange");
|
||||
$("#game_tread").attr("title", "取消踩")
|
||||
}else{
|
||||
treadStatus = false; // 已踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").removeClass("color-orange");
|
||||
$("#game_tread").attr("title", "踩");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// end
|
||||
|
||||
// test_sets:测试集;had_test_count:输出集的个数;test_sets_count:测试集的个数;had_passed_testsests_error_count:测试集报错数;test_sets_hidden_count:隐藏测试集的个数
|
||||
// test_sets_public_count:公开测试集的个人;had_passed_testsests_hidden_count:通过的隐藏集个数;had_passed_testsests_public_count:通过的公开测试集个数
|
||||
// final_score:最终得分;latest_output:最新的输出;language:实训的语言
|
||||
|
|
@ -403,7 +534,5 @@ function code_evaluation(test_sets,
|
|||
$("#game_test_set_results").html($html);
|
||||
|
||||
}
|
||||
console.log($("#evaluating_info"));
|
||||
console.log($(".-task-ces-box"));
|
||||
// end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue