You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

new_user.js 22 kB

11 years ago
11 years ago
11 years ago
11 years ago
​
11 years ago
11 years ago
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. $(function(){
  2. //右侧最小高度 = 左侧高度 - 15px 保证两边高度基本一样,页面美观
  3. $("#RSide").css("min-height",$("#LSide").height()-35);
  4. //$("#users_setting").css("min-height",$("#LSide").height()-100);
  5. //头像相关
  6. $("#homepage_portrait_image").on("mouseover",function(){
  7. $("#edit_user_file_btn").show();
  8. $("#watch_user_btn").show();
  9. }).on("mouseout",function(){
  10. $("#edit_user_file_btn").hide();
  11. $("#watch_user_btn").hide();
  12. });
  13. //日历选择样式
  14. //$(".ui-datepicker-trigger").replaceWith("<div class='fl DateBorder mr10'><img class='ui-datepicker-trigger'></div>")
  15. });
  16. //编辑个人简介
  17. function show_edit_user_introduction() {
  18. $("#user_brief_introduction_show").hide();
  19. $("#user_brief_introduction_edit").show();
  20. $("#user_brief_introduction_edit").focus();
  21. }
  22. //编辑个人简介完成之后提交
  23. function edit_user_introduction(url){
  24. $.get(
  25. url,
  26. { brief_introduction: $("#user_brief_introduction_edit").val() },
  27. function (data) {
  28. }
  29. );
  30. }
  31. //显示更多的课程
  32. function show_more_course(url){
  33. $.get(
  34. url,
  35. function (data) {
  36. }
  37. );
  38. }
  39. //显示更多的项目
  40. function show_more_project(url){
  41. $.get(
  42. url,
  43. function (data) {
  44. }
  45. );
  46. }
  47. //个人留言
  48. function jour_submit(){
  49. if(jourReplyVerify()){
  50. $("#private_flag").val("0");
  51. jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
  52. $("#user_feedback_new").submit();
  53. }
  54. }
  55. function private_jour_submit(){
  56. if(jourReplyVerify()){
  57. $("#private_flag").val("1");
  58. jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
  59. $("#user_feedback_new").submit();
  60. }
  61. }
  62. function jourReplyVerify() {
  63. var content = jour_content_editor.html();//$.trim($("#message_content").val());
  64. if (jour_content_editor.isEmpty()) {
  65. $("#jour_content_span").text("留言不能为空");
  66. $("#jour_content_span").css('color', '#ff0000');
  67. $("#submit_feedback_user").one('click',function() {
  68. jour_submit();
  69. });
  70. $("#private_submit_feedback_user").one('click',function() {
  71. private_jour_submit();
  72. });
  73. return false;
  74. }
  75. else {
  76. $("#jour_content_span").text("填写正确");
  77. $("#jour_content_span").css('color', '#008000');
  78. return true;
  79. }
  80. }
  81. //老师提交 新建/修改 作业
  82. function submit_homework(id){
  83. if(!regex_homework_name()){
  84. $("#homework_name").focus();
  85. }
  86. else if(!regex_homework_end_time()){
  87. $("#homework_end_time").focus();
  88. }
  89. else if(!regex_homework_end_publish_time()){
  90. $("#homework_end_time").focus();
  91. }
  92. else if(!regex_course_id()){
  93. $("#course_id").focus();
  94. }
  95. else{
  96. homework_description_editor.sync();
  97. $("#"+id).submit();
  98. }
  99. }
  100. //验证新建作业的名字
  101. function regex_homework_name()
  102. {
  103. var name = $.trim($("#homework_name").val());
  104. if(name=="")
  105. {
  106. $("#homework_name_span").text("名称不能为空");
  107. return false;
  108. }
  109. else
  110. {
  111. $("#homework_name_span").text("");
  112. return true;
  113. }
  114. }
  115. //验证发布时间不能大于截止时间
  116. function regex_homework_end_publish_time()
  117. {
  118. var myDate = new Date();
  119. if($.trim($("#homework_publish_time").val()) == "")
  120. {
  121. $("#homework_publish_time").val(formate_date(myDate));
  122. }
  123. var end_time = Date.parse($("#homework_end_time").val());
  124. var publish_time = Date.parse($("#homework_publish_time").val());
  125. if(end_time < publish_time)
  126. {
  127. $("#homework_end_time_span").text("截止日期不能小于发布日期");
  128. return false;
  129. }
  130. else
  131. {
  132. $("#homework_end_time_span").text("");
  133. return true;
  134. }
  135. }
  136. //验证截止时间
  137. function regex_homework_end_time()
  138. {
  139. var name = $.trim($("#homework_end_time").val());
  140. if(name=="")
  141. {
  142. $("#homework_end_time_span").text("截止时间不能为空");
  143. return false;
  144. }
  145. else
  146. {
  147. $("#homework_end_time_span").text("");
  148. return true;
  149. }
  150. }
  151. function formate_date(date){
  152. var str = "";
  153. var year = date.getFullYear();
  154. var month = date.getMonth() + 1;
  155. var day = date.getDate();
  156. if(month < 10) {
  157. month = '0' + month;
  158. }
  159. if(day < 10) {
  160. day = '0' + day;
  161. }
  162. str = year + '-' + month + '-' + day;
  163. return str;
  164. }
  165. //验证发送到课程
  166. function regex_course_id(){
  167. var course_id = $("#course_id").val();
  168. if(course_id == -1)
  169. {
  170. $("#homework_course_id_span").text("发布课程不能为空");
  171. return false;
  172. }
  173. else
  174. {
  175. $("#homework_course_id_span").text("");
  176. return true;
  177. }
  178. }
  179. //验证分组作业的参数
  180. function regex_group_attr(){
  181. var min = $.trim($("#min_num").val());
  182. var max = $.trim($("#max_num").val());
  183. var regex = /^\d+$/;
  184. if(!regex.test(min) || parseInt(min) <= 0) {
  185. $("#min_max_num_notice").html("人数为正整数");
  186. $("#min_max_num_notice").show();
  187. $("#min_num").focus();
  188. return false;
  189. } else {
  190. $("#min_max_num_notice").html("");
  191. $("#min_max_num_notice").hide();
  192. }
  193. if(!regex.test(max) || parseInt(max) <= 0) {
  194. $("#min_max_num_notice").html("人数为正整数");
  195. $("#min_max_num_notice").show();
  196. $("#max_num").focus();
  197. return false;
  198. } else {
  199. $("#min_max_num_notice").html("");
  200. $("#min_max_num_notice").hide();
  201. }
  202. if(parseInt(min) > parseInt(max)) {
  203. $("#min_max_num_notice").html("最小人数不得大于最大人数");
  204. $("#min_max_num_notice").show();
  205. $("#max_num").focus();
  206. return false;
  207. } else {
  208. $("#min_max_num_notice").html("");
  209. $("#min_max_num_notice").hide();
  210. }
  211. if ($("#base_on_project").is(":checked")) {
  212. $("#base_on_project").val(1);
  213. } else {
  214. $("#base_on_project").val(0);
  215. }
  216. return true;
  217. }
  218. //验证编程作业的参数
  219. function regex_program_attr() {
  220. var result = true;
  221. $.each($('#programHomework textarea.InputBox'), function(i, val){
  222. if (result && $(val).val().length<=0) {
  223. $(val)[0].focus();
  224. result = false;
  225. }
  226. });
  227. return result;
  228. }
  229. //老师导入作业时查询作业
  230. function search_homework_by_name(url){
  231. $.get(
  232. url,
  233. { name: $("#search_homework_name").val() },
  234. function (data) {
  235. }
  236. );
  237. }
  238. //提交匿评参数设置
  239. function submit_set_evaluation_attr(end_time){
  240. if(!regex_evaluation_start(end_time)){
  241. $("#evaluation_start_time").focus();
  242. }
  243. else if(!regex_evaluation_end()){
  244. $("#evaluation_end_time").focus();
  245. }
  246. else if(!regex_evaluation_num()){
  247. $("#evaluation_num").focus();
  248. }
  249. else{
  250. $('#muban_popup_box form').submit();
  251. hideModal();
  252. }
  253. }
  254. //验证匿评开启时间:大于截止时间,或者为空
  255. function regex_evaluation_start(end_time){
  256. var evaluation_start = $.trim($("#evaluation_start_time").val());
  257. if(evaluation_start == ""){
  258. $("#homework_evaluation_start_time").text("开启匿评日期不能为空");
  259. return false;
  260. }
  261. var end_time = new Date(end_time);
  262. var evaluation_start_time = new Date(evaluation_start);
  263. if(evaluation_start_time > end_time){
  264. $("#homework_evaluation_start_time").text("");
  265. return true;
  266. }else{
  267. $("#homework_evaluation_start_time").text("开启匿评日期必须大于截止日期");
  268. return false;
  269. }
  270. }
  271. //验证匿评结束时间:大于匿评开启时间,或者为空。当匿评开启时间为空时,匿评结束时间必须为空
  272. function regex_evaluation_end(){
  273. var evaluation_start = $.trim($("#evaluation_start_time").val());
  274. var evaluation_end = $.trim($("#evaluation_end_time").val());
  275. if(evaluation_end == ""){
  276. $("#homework_evaluation_end_time").text("关闭匿评日期不能为空");
  277. return true;
  278. }
  279. var evaluation_start_time = new Date(evaluation_start);
  280. var evaluation_end_time = new Date(evaluation_end);
  281. if(evaluation_end_time >= evaluation_start_time){
  282. $("#homework_evaluation_end_time").text("");
  283. return true;
  284. }else{
  285. $("#homework_evaluation_end_time").text("关闭匿评日期不能小于开启匿评日期");
  286. return false;
  287. }
  288. }
  289. //处理迟交、缺评扣分
  290. function check_late_penalty(id)
  291. {
  292. var obj = $("#" + id);
  293. var regex = /^\d+$/;
  294. if(regex.test(obj.val()))
  295. {
  296. if(obj.val() > 50)
  297. {
  298. obj.val("50");
  299. }
  300. }
  301. else
  302. {
  303. obj.val("");
  304. }
  305. }
  306. //验证匿评数量
  307. function regex_evaluation_num(){
  308. var evaluation_num = $.trim($("#evaluation_num").val());
  309. var regex = /^\d+$/;
  310. if(evaluation_num==""){
  311. $("#evaluation_num_notice").text("匿评人数不能为空");
  312. return false;
  313. }
  314. else if(regex.test(evaluation_num)){
  315. if(evaluation_num > 0){
  316. $("#evaluation_num_notice").html("");
  317. return true;
  318. }
  319. else{
  320. $("#evaluation_num_notice").text("匿评人数必须为大于0");
  321. return false;
  322. }
  323. }
  324. else{
  325. $("#evaluation_num_notice").text("匿评人数只能为数字");
  326. return false;
  327. }
  328. }
  329. //提交新建作品
  330. function new_student_work()
  331. {
  332. if(regexStudentWorkName()&&regexStudentWorkDescription())
  333. {
  334. if($("#group_member_ids").length > 0) {
  335. if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
  336. $("#new_student_work").submit();
  337. $("#ajax-indicator").hide();
  338. }
  339. } else {
  340. $("#new_student_work").submit();
  341. $("#ajax-indicator").hide();
  342. }
  343. }
  344. }
  345. function edit_student_work(id)
  346. {
  347. if(regexStudentWorkName()&&regexStudentWorkDescription())
  348. {
  349. if($("#group_member_ids").length > 0) {
  350. if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
  351. $("#edit_student_work_" + id).submit();
  352. $("#ajax-indicator").hide();
  353. }
  354. } else {
  355. $("#edit_student_work_" + id).submit();
  356. $("#ajax-indicator").hide();
  357. }
  358. }
  359. }
  360. //验证作品名称
  361. function regexStudentWorkName()
  362. {
  363. var name = $.trim($("#student_work_name").val());
  364. if(name=="")
  365. {
  366. $("#student_work_name_span").text("作品名称不能为空");
  367. return false;
  368. }
  369. else
  370. {
  371. $("#student_work_name_span").text("");
  372. return true;
  373. }
  374. }
  375. function regexStudentWorkDescription()
  376. {
  377. var name = $.trim($("#student_work_description").val());
  378. if(name=="")
  379. {
  380. $("#student_work_description_textarea").text("作品描述不能为空");
  381. return false;
  382. }
  383. else
  384. {
  385. $("#student_work_description_textarea").text("");
  386. return true;
  387. }
  388. }
  389. function regexStudentWorkMember(min, max) {
  390. var members = $.trim($("#group_member_ids").val()).split(',');
  391. if ( min <= members.length && members.length <= max ){
  392. $("#student_work_group_textarea").text("");
  393. return true;
  394. } else {
  395. $("#student_work_group_textarea").text("合作成员人数应为:"+min+"-"+max+"人");
  396. return false;
  397. }
  398. }
  399. //学生作品
  400. function show_project()
  401. {
  402. $("#about_project").slideToggle();
  403. }
  404. //添加分组成员
  405. function show_group_member(){
  406. $("#chooseGroupMember").dialog("open");
  407. $(".ui-dialog-titlebar").hide();
  408. $("a.popClose").on('click', function(){
  409. $("#chooseGroupMember" ).dialog("close");
  410. });
  411. $("#cancel_add").on('click', function(){
  412. $("#chooseGroupMember" ).dialog("close");
  413. });
  414. //$('#min_num').focus();
  415. }
  416. //textarea自适应高度 纯js写的 有浏览器判断
  417. /**
  418. * 文本框根据输入内容自适应高度
  419. * @param {HTMLElement} 输入框元素
  420. * @param {Number} 设置光标与输入框保持的距离(默认0)
  421. * @param {Number} 设置最大高度(可选)
  422. */
  423. var autoTextarea = function (elem, extra, maxHeight) {
  424. extra = extra || 0;
  425. var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,
  426. isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera'),
  427. addEvent = function (type, callback) {
  428. elem.addEventListener ?
  429. elem.addEventListener(type, callback, false) :
  430. elem.attachEvent('on' + type, callback);
  431. },
  432. getStyle = elem.currentStyle ? function (name) {
  433. var val = elem.currentStyle[name];
  434. if (name === 'height' && val.search(/px/i) !== 1) {
  435. var rect = elem.getBoundingClientRect();
  436. return rect.bottom - rect.top -
  437. parseFloat(getStyle('paddingTop')) -
  438. parseFloat(getStyle('paddingBottom')) + 'px';
  439. };
  440. return val;
  441. } : function (name) {
  442. return getComputedStyle(elem, null)[name];
  443. },
  444. minHeight = parseFloat(getStyle('height'));
  445. elem.style.resize = 'none';
  446. var change = function () {
  447. var scrollTop, height,
  448. padding = 0,
  449. style = elem.style;
  450. if (elem._length === elem.value.length) return;
  451. elem._length = elem.value.length;
  452. if (!isFirefox && !isOpera) {
  453. padding = parseInt(getStyle('paddingTop')) + parseInt(getStyle('paddingBottom'));
  454. };
  455. scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
  456. elem.style.height = minHeight + 'px';
  457. if (elem.scrollHeight > minHeight) {
  458. if (maxHeight && elem.scrollHeight > maxHeight) {
  459. height = maxHeight - padding;
  460. style.overflowY = 'auto';
  461. } else {
  462. height = elem.scrollHeight - padding;
  463. style.overflowY = 'hidden';
  464. };
  465. style.height = height + extra + 'px';
  466. scrollTop += parseInt(style.height) - elem.currHeight;
  467. document.body.scrollTop = scrollTop;
  468. document.documentElement.scrollTop = scrollTop;
  469. elem.currHeight = parseInt(style.height);
  470. };
  471. };
  472. addEvent('propertychange', change);
  473. addEvent('input', change);
  474. addEvent('focus', change);
  475. change();
  476. };
  477. function limitStrsize(id,length){
  478. $('#'+id).keypress(function(e)
  479. {
  480. var n = 0;
  481. var str = this.value;
  482. for (i = 0; i < str.length; i++) {
  483. var leg = str.charCodeAt(i);//ASCII码
  484. if (leg > 255) {//大于255的都是中文
  485. n += 2;//如果是中文就是2个字节
  486. } else {
  487. n += 1;//英文,不多说了
  488. }
  489. }
  490. if(n >= length && e.keyCode !== 8)
  491. if(document.all)
  492. {
  493. e.returnValue = false;
  494. }
  495. else
  496. {
  497. e.preventDefault();
  498. }
  499. })
  500. }
  501. /////////////////////////////////////////////////////////////////////////////////////创建项目
  502. //验证项目名称是不是为空
  503. function regex_project_name(){
  504. var name = $.trim($("#project_name").val());
  505. if(name=="")
  506. {
  507. $("#project_name_error_msg").text("项目名称不能为空");
  508. return false;
  509. }
  510. else
  511. {
  512. $("#project_name_error_msg").text("");
  513. return true;
  514. }
  515. }
  516. //验证项目名称是否重复---项目名称可以重复。。。。
  517. function regex_project_name_same(){
  518. var name = $.trim($("#project_name").val());
  519. return true;
  520. }
  521. //验证项目描述
  522. function regex_project_desc(){
  523. var desc = $.trim($("#project_description").val());
  524. if(desc == "")
  525. {
  526. $("#project_desc_error_msg").text("项目名称不能为空");
  527. return false;
  528. }
  529. else
  530. {
  531. $("#project_desc_error_msg").text("");
  532. return true;
  533. }
  534. }
  535. //提交
  536. function submit_project(){
  537. if(regex_project_name()&&regex_project_desc()){
  538. $("#new_project").submit();
  539. }
  540. }
  541. /////////////////////////////////////////////////////////////////////////////////////创建项目 end
  542. //匿评弹框取消按钮
  543. function clickCanel(){hideModal("#popbox02");}
  544. //匿评弹框确定按钮
  545. function clickOK(path)
  546. {
  547. clickCanel();
  548. $.ajax({
  549. type: "GET",
  550. url: path,
  551. data: 'text',
  552. success: function (data) {
  553. }
  554. });
  555. }
  556. //关闭引入资源弹框
  557. function hideResource(){
  558. $('#ajax-modal').parent().removeClass("popbox").removeClass("referenceResourcesPopup");
  559. hideModal();
  560. }
  561. /////////////////////////////////////////////////////////////////////////////////////////
  562. var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
  563. extra = extra || 0;
  564. var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,
  565. isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera'),
  566. addEvent = function (element, type, callback) {
  567. element.addEventListener ?
  568. element.addEventListener(type, callback, false) :
  569. element.attachEvent('on' + type, callback);
  570. },
  571. getFirstStyle = elem.currentStyle ? function (name) {
  572. var val = elem.currentStyle[name];
  573. if (name === 'height' && val.search(/px/i) !== 1) {
  574. var rect = elem.getBoundingClientRect();
  575. return rect.bottom - rect.top -
  576. parseFloat(getFirstStyle('paddingTop')) -
  577. parseFloat(getFirstStyle('paddingBottom')) + 'px';
  578. };
  579. return val;
  580. } : function (name) {
  581. return getComputedStyle(elem, null)[name];
  582. },
  583. minHeight = parseFloat(getFirstStyle('height'));
  584. elem.style.resize = 'none';
  585. elem2.style.resize = 'none';
  586. var change = function () {
  587. var scrollTop, height,
  588. padding = 0,
  589. style = elem.style,
  590. style2 = elem2.style;
  591. if (elem._length === elem.value.length) return;
  592. elem._length = elem.value.length;
  593. elem2._length = elem._length;
  594. if (!isFirefox && !isOpera) {
  595. padding = parseInt(getFirstStyle('paddingTop')) + parseInt(getFirstStyle('paddingBottom'));
  596. };
  597. scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
  598. elem.style.height = minHeight + 'px';
  599. elem2.style.height = minHeight + 'px';
  600. if (elem.scrollHeight > minHeight) {
  601. if (maxHeight && elem.scrollHeight > maxHeight) {
  602. height = maxHeight - padding;
  603. style.overflowY = 'auto';
  604. style2.overflowY = 'auto';
  605. } else {
  606. height = elem.scrollHeight - padding;
  607. };
  608. style.height = height + extra + 'px';
  609. style2.height = height + extra + 'px';
  610. scrollTop += parseInt(style.height) - elem.currHeight;
  611. document.body.scrollTop = scrollTop;
  612. document.documentElement.scrollTop = scrollTop;
  613. elem.currHeight = parseInt(style.height);
  614. };
  615. if (elem2.scrollHeight > minHeight) {
  616. if (maxHeight && elem2.scrollHeight > maxHeight) {
  617. height = maxHeight - padding;
  618. style.overflowY = 'auto';
  619. style2.overflowY = 'auto';
  620. } else {
  621. height = elem2.scrollHeight - padding;
  622. };
  623. style.height = height + extra + 'px';
  624. style2.height = height + extra + 'px';
  625. scrollTop += parseInt(style2.height) - elem2.currHeight;
  626. document.body.scrollTop = scrollTop;
  627. document.documentElement.scrollTop = scrollTop;
  628. elem2.currHeight = parseInt(style2.height);
  629. };
  630. };
  631. addEvent(elem, 'propertychange', change);
  632. addEvent(elem, 'input', change);
  633. addEvent(elem, 'focus', change);
  634. addEvent(elem2, 'propertychange', change);
  635. addEvent(elem2, 'input', change);
  636. addEvent(elem2, 'focus', change);
  637. change();
  638. };
  639. function user_name_keypress(e){
  640. if (e.keyCode == '13') {
  641. $('#main_login_form').submit();
  642. }
  643. }
  644. function changeRegisterBtn(checkbox){
  645. if(checkbox.checked == true){
  646. $("#loginUpButton").removeClass('new_login_submit_disable');
  647. $("#loginUpButton").addClass('new_login_submit');
  648. }else{
  649. $("#loginUpButton").removeClass('new_login_submit')
  650. $("#loginUpButton").addClass('new_login_submit_disable');
  651. }
  652. }
  653. function clearInfo(id, content) {
  654. var text = $('#' + id);
  655. if (text.val() == content) {
  656. $('#' + id).val('');
  657. }
  658. }
  659. function showInfo(id, content) {
  660. var text = $('#' + id);
  661. if (text.val() == '') {
  662. $('#' + id).val(content);
  663. }
  664. }
  665. function login(){
  666. $('#main_login_form').submit(); //表单提交没有任何反应的原因:js冲突
  667. }
  668. function register(){
  669. if($("#loginUpButton").hasClass('new_login_submit_disable')){
  670. return;
  671. }
  672. if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){
  673. $("#main_reg_form").submit();
  674. }else{
  675. $('#user_login').blur();
  676. $('#user_mail').blur();
  677. $('#user_password').blur();
  678. $('#user_password_confirmation').blur();
  679. }
  680. }

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...