2 <meta charset
="Shift_JIS">
3 <script src
="jquery.js"></script
>
4 <script src
="jquery-md5.js"></script
>
6 function setCookie(cname
, cvalue
, exdays
) {
8 d
.setTime(d
.getTime() +
(exdays
*24*60*60*1000));
9 var expires
= "expires="+d
.toGMTString();
10 document
.cookie
= cname +
"=" + cvalue +
"; " + expires
;
12 function getCookie(cname
) {
13 var name
= cname +
"=";
14 var ca
= document
.cookie
.split(';');
15 for(var i
=0; i
<ca
.length
; i++
) {
17 while (c
.charAt(0)==' ') c
= c
.substring(1);
18 if (c
.indexOf(name
) != -1) return c
.substring(name
.length
,c
.length
);
22 function getQueryParams(qs
) {
23 qs
= qs
.split("+").join(" ");
24 var params
= {}, tokens
,
25 re
= /[?
&]?
([^
=]+
)=([^
&]*)/g
;
27 while (tokens
= re
.exec(qs
)) {
28 params
[decodeURIComponent(tokens
[1])]
29 = decodeURIComponent(tokens
[2]);
33 function implode(i
,s
){
36 for(var t
=0;t
<(s
.length
-1);t++
){
37 r+
=((r
.length
==0)?
'':i
)+s
[t
];
41 Object.size
= function(obj
) {
44 if (obj
.hasOwnProperty(key
)) size++
;
48 $
(document
).ready(function(){
49 var threads_data
= '';
52 var query
= getQueryParams(document
.location
.search
);
53 var domain
= query
.domain
;
54 var board
= query
.board
;
55 var threads_data
= '';
57 $
.get('http://i.2ch.net/subject.txt',function(d
){
58 var splt
= d
.split('\n');
59 for(var i
=0;i
<splt
.length
;i++
){
60 //console.log(splt[i]);
61 var data
= splt
[i
].split("<>");
64 var data_filename
= data
[0];
65 var data_title
= data
[1];
66 var title
= data_title
.split("(");
67 var numofreply
= "("+title
[1];
69 var TT
= implode('(',title
);
74 var arr_selected
=new Object();
75 arr_selected
= eval(getCookie('arr_selected'));
78 var thread_selected
= getCookie('thread_selected');
79 if(thread_selected
.length
>0 && thread_selected
== $
.md5(domain+data_filename
)){
81 var class_thread_menu
= 'email-item-selected email-item pure-g';
82 //if(arr_selected[$.md5(domain+data_filename+numofreply)]){
83 //$class_thread_menu = 'email-item pure-g';//<~~
85 //$newblue = 'color:red';
87 arr_selected
[$
.md5(domain+data_filename+numofreply
)] = true;
88 setCookie('arr_selected',arr_selected
);
90 if(Object.size(arr_selected
)>0 && arr_selected
[$
.md5(domain+data_filename+numofreply
)]){
91 class_thread_menu
= 'email-item pure-g';
93 class_thread_menu
= 'email-item-unread email-item pure-g';
96 var datfile
= $
.md5(domain+data_filename+numofreply
);
103 threads_data +
= '<div id="thread-'+
(i+
1)+
'" class="'+class_thread_menu+
'">';
104 threads_data +
= ' <div class="pure-u-3-4 pure-u-3-4-resize">';
105 threads_data +
= ' <h5 class="email-name">'+
(i+
1)+
'. <span style="'+newblue+
'">'+numofreply+
'</span>:</h5>';
106 threads_data +
= ' <input style="display:none" id="mdid" type="hidden" value="'+datfile+
'" >';
107 threads_data +
= ' <input style="display:none" id="mdcid" type="hidden" value="'+$
.md5(domain+data
['filename'])+
'" >';
108 threads_data +
= ' <h4 class="email-subject">'+TT
;
109 threads_data +
= ' <a href="api_content.php?domain='+domain+
'&board='+board+
'&filename='+data
['filename']+
'&mdid='+datfile+
'&mdcid='+$
.md5(domain+data
['filename'])+
'&nav=l25" style="float:left;visibility: hidden;"></a>';
110 threads_data +
= ' </h4>';
111 threads_data +
= ' </div>';
112 threads_data +
= '</div>';
115 $
('#result').html(threads_data
);
120 <div id
="result"></div
>