textAd.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. $("span").append("<div></div>")
  2. var count_max = 0;
  3. $(".btn1").click(function() {
  4. $(".fm").hide();
  5. test_show();
  6. });
  7. $(".return").click(function() {
  8. test_show();
  9. });
  10. function test_show() {
  11. playMusic("./img/MAIN/2015/05/115577/1792.mp3");
  12. var num = [];
  13. var count = 0;
  14. var time = 1500;
  15. var test_num = 0;
  16. function test(id) {
  17. clearTimeout(timeOut);
  18. var Did = $(id);
  19. var list = [];
  20. $(".js").animate({
  21. "left": "0"
  22. });
  23. $(".fd_con").animate({
  24. "left": "640px"
  25. });
  26. var arr = [];
  27. var arr_a = [];
  28. for (var i = 0; i < Did.length; i++) {
  29. arr[i] = i;
  30. };
  31. arr_a = arr.sort(function() {
  32. return Math.random() > 0.5 ? -1 : 1;
  33. })
  34. for (var j = 0; j < 5; j++) {
  35. //var Ntime=j*2;
  36. list += "<li><p class='p_a'>" + Number((j + 1) + 5 * test_num) + "/20</p>" + Did.eq(arr_a[j]).html() + "" + "</li>";
  37. };
  38. test_num++;
  39. return list;
  40. }
  41. $(".js_a").html(test(".list1 li") + test(".list2 li") + test(".list3 li") + test(".list4 li"));
  42. $(".js_a li").hide();
  43. var c = 0;
  44. $(".js_a li").eq(0).show();
  45. var t = setTimeout(timedCount(c), 1000);
  46. function timedCount(c) {
  47. $(".p_b").html(c + "秒");
  48. c = c + 1;
  49. }
  50. var timeOut = setTimeout(function() {
  51. stoppage()
  52. }, 2000);
  53. $(".js_a li").eq(0).find('span div').animate({
  54. "width": 0,
  55. "margin-left": 0
  56. },
  57. 2000);
  58. function stoppage() {
  59. clearTimeout(timeOut);
  60. clearTimeout(t);
  61. $(".js").animate({
  62. "left": -640
  63. });
  64. $(".fd_con").animate({
  65. "left": 0
  66. });
  67. $(".p_b").html("0秒");
  68. mySound.stop();
  69. var score = count * 2;
  70. //updateShare(shareDesc);
  71. //Play68.setRankingScoreDesc(score);
  72. console.log(score);
  73. }
  74. $(".js_a li span em").click(function(event) {
  75. var result = eval($(this).parent().parent().find('i').html());
  76. if ($(this).html() == result) {
  77. clearTimeout(timeOut);
  78. var n = ($(this).parent().parent().index() + 1) * 2;
  79. var t1 = setInterval(timedCount(n), 1000);
  80. $(this).parent().parent().next().show();
  81. if (count > 15) {
  82. timeOut = setTimeout(function() {
  83. stoppage()
  84. }, 1500);
  85. $(this).parent().parent().next().find('span div').animate({
  86. "width": 0,
  87. "margin-left": 0
  88. }, 1500);
  89. } else {
  90. timeOut = setTimeout(function() {
  91. stoppage()
  92. }, 2000);
  93. $(this).parent().parent().next().find('span div').animate({
  94. "width": 0,
  95. "margin-left": 0
  96. }, 2000);
  97. }
  98. count++;
  99. } else {
  100. $(".js").animate({
  101. "left": -640
  102. });
  103. $(".fd_con").animate({
  104. "left": 0
  105. });
  106. mySound.stop();
  107. $(".p_b").html("0秒");
  108. clearTimeout(timeOut);
  109. clearTimeout(t);
  110. stoppage();
  111. }
  112. countAnd(count);
  113. });
  114. }
  115. function countAnd(count) {
  116. if (count >= 0 && count <= 5) {
  117. $(".fd_con .pl").html("<p>我答对了<i>" + count + "</i>题&nbsp;坚持了<i>" + count * 2 + "</i>秒</p><h1><img src='./img/MAIN/2015/05/115577/images/t1.png' /></h1>");
  118. $(".plb").addClass('bad');
  119. shareDesc = "我撑过了" + count * 2 + "秒,我的数学是体育老师教的……";
  120. }
  121. if (count > 5 && count <= 10) {
  122. $(".fd_con .pl").html("<p>我答对了<i>" + count + "</i>题&nbsp;坚持了<i>" + count * 2 + "</i>秒</p><h1><img src='./img/MAIN/2015/05/115577/images/t2.png' /></h1>");
  123. $(".plb").addClass('bad');
  124. shareDesc = "我撑过了" + count * 2 + "秒,老师我对不起你……跪!!";
  125. }
  126. if (count > 10 && count <= 15) {
  127. $(".fd_con .pl").html("<p>我答对了<i>" + count + "</i>题&nbsp;坚持了<i>" + count * 2 + "</i>秒</p><h1><img src='./img/MAIN/2015/05/115577/images/t3.png' /></h1>");
  128. $(".plb").removeClass('bad');
  129. shareDesc = "我撑过了" + count * 2 + "秒,妈妈再也不用担心我的学习啦!";
  130. }
  131. if (count > 15 && count <= 20) {
  132. $(".fd_con .pl").html("<p>我答对了<i>" + count + "</i>题&nbsp;坚持了<i>" + count * 2 + "</i>秒</p><h1 stlye='font-size:52px;line-height:100px;'><img src='./img/MAIN/2015/05/115577/images/t4.png' /></h1>");
  133. $(".plb").removeClass('bad');
  134. shareDesc = "我撑过了" + count * 2 + "秒,so easy!!!";
  135. }
  136. }