history.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. function article_list(cookieName,a_title){
  2. var isdone="none";
  3. if(mGetCookie("EMARTICLE9")!=null){
  4. for(i=0;i<10;i++){
  5. arr_temp_check=mGetCookie("EMARTICLE"+i).split("@#$");
  6. if(arr_temp_check.length>1){
  7. temp_check=arr_temp_check[1];
  8. arr_a_title=a_title.split("@#$")
  9. temp_arr_a_title=arr_a_title[0];
  10. if(temp_check==temp_arr_a_title){
  11. mSetCookie("EMARTICLE"+i,a_title);
  12. isdone="ok";
  13. //break;
  14. }
  15. }
  16. }
  17. }
  18. if(isdone=="none"){
  19. mreplacecookie(cookieName,a_title);
  20. new_article=mGetCookie(cookieName);
  21. for(i=0;i<9;i++){
  22. k=i+1;
  23. //if(mGetCookie('EMARTICLE'+k)==null){str_replace=""}else{str_replace=mGetCookie('EMARTICLE'+k)}
  24. mreplacecookie("EMARTICLE"+i,mGetCookie('EMARTICLE'+k));
  25. }
  26. mSetCookie("EMARTICLE9",new_article);
  27. }
  28. }
  29. function mSetCookie(cookieName,a_title) {
  30. var c_time=new Date();
  31. var s_month=(c_time.getMonth()+1).toString();
  32. var s_day=c_time.getDate().toString();
  33. var s_hour=c_time.getHours().toString();
  34. var s_minutes=c_time.getMinutes().toString();
  35. var s_seconds=c_time.getSeconds().toString();
  36. if(s_month.length<2){s_month="0"+s_month;}
  37. if(s_day.length<2){s_day="0"+s_day;}
  38. if(s_hour.length<2){s_hour="0"+s_hour;}
  39. if(s_minutes.length<2){s_minutes="0"+s_minutes;}
  40. if(s_seconds.length<2){s_seconds="0"+s_seconds;}
  41. var strtime=s_month+"-"+s_day+" "+s_hour+":"+s_minutes+":"+s_seconds
  42. var expires = new Date ();
  43. expires.setTime(expires.getTime() + 31 * (24 * 60 * 60 * 1000));
  44. // document.cookie = cookieName + "=" + strtime+ "@#$"+escape(a_title) +"; expires=" + expires.toGMTString();
  45. document.cookie = cookieName + "=" + strtime+ "@#$"+escape(a_title) +"; expires=" + expires.toGMTString() + ";path=/";
  46. }
  47. function mreplacecookie(cookieName,a_title){
  48. var expires = new Date ();
  49. expires.setTime(expires.getTime() + 31 * (24 * 60 * 60 * 1000));
  50. document.cookie = cookieName + "=" + escape(a_title)+"; expires=" + expires.toGMTString() + ";path=/";
  51. }
  52. function mGetCookie(name) {
  53. var dc = document.cookie;
  54. var prefix = name + "=";
  55. var begin = dc.indexOf("; " + prefix);
  56. if (begin == -1)
  57. {
  58. begin = dc.indexOf(prefix);
  59. if (begin != 0) return null;
  60. }
  61. else
  62. {
  63. begin += 2;
  64. }
  65. var end = document.cookie.indexOf(";", begin);
  66. if (end == -1)
  67. {
  68. end = dc.length;
  69. }
  70. return unescape(dc.substring(begin + prefix.length, end));
  71. }
  72. function mclearCookie(){
  73. var keys=document.cookie.match(/[^ =;]+(?=\=)/g);
  74. if (keys) {
  75. for (var i = keys.length; i--;){
  76. document.cookie=keys[i]+'=0;expires=' + new Date( 0).toUTCString() + ";path=/";
  77. }
  78. }
  79. }
  80. article_list('EMARTICLE0',document.title+'@#$'+window.location.href);
  81. listArticle=new Array();
  82. for(i=0;i<10;i++){
  83. listArticle[i]=mGetCookie('EMARTICLE'+i);
  84. //document.writeln(i+"="+listArticle[i]) ;
  85. //document.writeln("<br>") ;
  86. }
  87. listArticle.sort();
  88. var jj=new Array();
  89. for(i=listArticle.length-1;i>=0;i--){
  90. if(listArticle[i]!="null"){
  91. str_temp=listArticle[i].split("@#$");
  92. jj[i]=str_temp[1];
  93. // document.writeln(listArticle[i]);
  94. document.writeln("<li><a href='"+str_temp[2]+"'><h2><i class='ico_dot'></i>"+str_temp[1].replace(' - 信息','').substr(0,20)+"</h2></a></li>") ;
  95. //document.writeln("<br>") ;
  96. }
  97. }