zhibo.min.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //日期
  2. function getWeek(dateString) {
  3. var day = new Date(Date.parse(dateString));
  4. var today = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
  5. var week = today[day.getDay()];
  6. return week;
  7. };
  8. function indexDateF(){
  9. $('.contest_list .datedd').remove();
  10. function tDou(n){
  11. return n>9? n: "0"+n;
  12. }
  13. function GetDateStr(AddDayCount) {
  14. var dd = new Date();
  15. dd.setDate(dd.getDate()+AddDayCount);
  16. var y = dd.getFullYear();
  17. var m = tDou(dd.getMonth()+1);
  18. var d = tDou(dd.getDate());
  19. return [y+"-"+m+"-"+d,m,d,y];
  20. }
  21. for(i=-1;i<10;i++){
  22. var str=GetDateStr(i)[0];
  23. var m=GetDateStr(i)[1];
  24. var d=GetDateStr(i)[2];
  25. var y=GetDateStr(i)[3];
  26. if($('.contest_list li[data-datetime^='+str+']').length>0){
  27. var oDHtml="<p class='bs_time jintiancrq'>"+y+"-"+m+"-"+d+"<span>"+ getWeek(GetDateStr(i)[0]) +"</span></p>";
  28. $('.contest_list li[data-datetime^='+str+']').eq(0).before(oDHtml);
  29. }
  30. }
  31. }
  32. indexDateF();