Changeset 32754 for websites/modoki
- Timestamp:
- 04/23/09 16:44:16 (4 years ago)
- Files:
-
- 1 modified
-
websites/modoki/index.html (modified) (19 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
websites/modoki/index.html
- Property svn:mime-type set to text/html; charset=UTF-8
r32748 r32754 9 9 padding: 0; 10 10 } 11 html, body{11 html, body{ 12 12 height: 100%; 13 13 } … … 31 31 background: #999999; 32 32 height: 25px; 33 top: 0;33 top: 0; 34 34 } 35 35 #header_content{ … … 50 50 height: 50px; 51 51 background: #f6f6f6; 52 border: #aaa 1px solid;52 border: 1px solid #aaa; 53 53 } 54 54 #userInput{ … … 58 58 width: 100%; 59 59 height: 100%; 60 border: #aaa 1px solid;60 border: 1px solid #aaa; 61 61 background: #ffffff; 62 62 } … … 66 66 } 67 67 .blocked{ 68 border : 1px solid #00f;68 border: 1px solid #00f; 69 69 } 70 70 .noborder{ 71 border :none;71 border: 0 none; 72 72 } 73 73 .unread{ … … 95 95 </style> 96 96 <script type="text/javascript"> 97 var d =document;97 var d = document; 98 98 99 99 var content_load = function(){ 100 100 var modoki = new Modoki(); 101 } 101 }; 102 102 var Modoki = function(){ this.init(); }; //constractor 103 103 Modoki.prototype.init = function(){ … … 109 109 var loop = setInterval( function(){ _self.loadData(); }, 30000 ); 110 110 }; 111 111 112 112 Modoki.prototype.config = function(){ 113 113 var _self = this; … … 117 117 "s" : function(){ _self.fav(); }, 118 118 "e" : function(){ _self.open_url(); } 119 } 119 }; 120 120 this._altanative = (new Date).getTime(); 121 121 this._crosspost = 0; 122 } 122 }; 123 123 Modoki.prototype.loadKeyBind = function(){ 124 124 var _self = this; … … 127 127 if( t.nodeType == 1 ){ 128 128 var tn = t.tagName.toLowerCase(); 129 if( tn == 'input' || tn == 'textarea'){129 if( tn == "input" || tn == "textarea" ){ 130 130 return; 131 131 } … … 136 136 } 137 137 } 138 } 138 }; 139 139 document.addEventListener("keypress", keybind, false); 140 140 }; … … 150 150 var box = d.createElement("div"); 151 151 box.id = "main_content"; 152 var _tilme_line = d.createElement("ul");152 var _tilme_line = box.appendChild(d.createElement("ul")); 153 153 _tilme_line.id = "time_line"; 154 box.appendChild(_tilme_line);155 154 document.getElementById("content").appendChild(box); 156 155 … … 160 159 161 160 //output 162 var _out = d.createElement("div");161 var _out = f_cont.appendChild(d.createElement("div")); 163 162 _out.id = "out"; 164 163 _out.name = "out"; 165 f_cont.appendChild(_out);166 164 167 165 //input 168 var _userInput = d.createElement("div");166 var _userInput = f_cont.appendChild(d.createElement("div")); 169 167 _userInput.id = "userInput"; 170 168 _userInput.name = "userInput"; 171 169 172 var _multiple = d.createElement("textarea");170 var _multiple = _userInput.appendChild(d.createElement("textarea")); 173 171 _multiple.id = "multiple"; 174 172 _multiple.name = "multiple"; 175 _userInput.appendChild(_multiple);176 173 177 174 _multiple.addEventListener("keypress", function(e){ … … 180 177 _self.postTwitter(); 181 178 this.blur(); 182 }else if( e.which == 9) { //if tab179 }else if( e.which == 9){ //if tab 183 180 e.preventDefault(); 184 181 this.blur(); … … 187 184 }, false ); 188 185 189 f_cont.appendChild(_userInput);190 186 document.getElementById("footer").appendChild(f_cont); 191 192 } 187 }; 193 188 Modoki.prototype.down = function(){ 194 189 this.move(true); 195 } 190 }; 196 191 Modoki.prototype.up = function(){ 197 192 this.move(false); 198 } 193 }; 199 194 Modoki.prototype.move = function(flg){ 200 var diff = (flg)? 1 : -1;195 var diff = flg ? 1 : -1; 201 196 202 197 var check = d.getElementsByClassName("blocked"); … … 210 205 if( nt[i].className.indexOf("blocked") != -1 ){ 211 206 d.getElementById("out").innerHTML = nt[i+diff].innerHTML; 212 nt[i].className = nt[i].className.replace(/ (blocked|unread)/,"noborder");213 nt[i+diff].className = nt[i+diff].className.replace(/ (noborder|unread)/,"blocked read");207 nt[i].className = nt[i].className.replace(/blocked|unread/,"noborder"); 208 nt[i+diff].className = nt[i+diff].className.replace(/noborder|unread/,"blocked read"); 214 209 var scroll = (nt[i+diff].offsetHeight-2) * diff; 215 210 window.scrollBy(0, scroll); … … 218 213 } 219 214 } 220 } 215 }; 221 216 222 217 Modoki.prototype.postTwitter = function(){ … … 224 219 text = (text.length>140) ? text.substring(0,140) : text; 225 220 if( text.length != 0 ){ 226 var url = 'http://twitter.com/statuses/update.xml?status=' + encodeURIComponent(text) + '&source=modoki';221 var url = "https://twitter.com/statuses/update.xml?status=" + encodeURIComponent(text) + "&source=modoki"; 227 222 this.crossDomainPost(url); 228 223 } 229 224 d.getElementById("multiple").value = ""; 230 } 225 }; 231 226 232 227 Modoki.prototype.fav = function(){ 233 228 var t = d.getElementsByClassName("blocked"); 234 var url = "http ://twitter.com/favourings/create/" + t[0].id + ".xml";229 var url = "https://twitter.com/favourings/create/" + t[0].id + ".xml"; 235 230 this.crossDomainPost(url); 236 231 t[0].className += " fav"; 237 } 232 }; 238 233 239 234 Modoki.prototype.open_url = function(){ … … 241 236 var m = t[0].innerHTML.match(/https?:\/\/[-_.!~*'()a-zA-Z0-9;/?:@&=+$,%#]+/g); 242 237 if( m.length > 1 ){ window.open(m[1]); } 243 } 238 }; 244 239 245 240 Modoki.prototype.crossDomainPost = function( url ){ 246 241 this._crosspost++; 247 var iframe = document.createElement( 'iframe');248 iframe.name = 'cross_domain_post'+ this._crosspost;249 iframe.style.display = 'none';250 251 var form = document.createElement( 'form');242 var iframe = document.createElement("iframe"); 243 iframe.name = "cross_domain_post" + this._crosspost; 244 iframe.style.display = "none"; 245 246 var form = document.createElement("form"); 252 247 form.action = url; 253 form.target = 'cross_domain_post'+ this._crosspost;254 form.method = 'POST';255 form.style.display = 'none';248 form.target = "cross_domain_post" + this._crosspost; 249 form.method = "post"; 250 form.style.display = "none"; 256 251 document.body.appendChild(form); 257 252 … … 266 261 }; 267 262 document.body.appendChild(iframe); 268 } 263 }; 269 264 270 265 Modoki.prototype.loadData = function(){ 271 266 this._altanative++; 272 var url = "http ://twitter.com/statuses/friends_timeline.json?callback=cb" + "&alter=" + this._altanative;267 var url = "https://twitter.com/statuses/friends_timeline.json?callback=cb" + "&alter=" + this._altanative; 273 268 this.getJSON(url); 274 } 269 }; 275 270 Modoki.prototype.getJSON = function(url){ 276 var script = d.createElement("script"); 271 var head = d.getElementsByTagName("head")[0]; 272 var script = head.appendChild(d.createElement("script")); 277 273 script.src = url; 278 script.type="text/javascript"; 279 var head = d.getElementsByTagName("head")[0]; 280 head.appendChild(script); 281 } 274 script.type = "text/javascript"; 275 }; 282 276 var cb = function(data){ 283 for( var i=data.length-1; i != 0 ; i-- ){ 284 createLiTag(data[i]); 285 } 286 var _script= d.getElementsByTagName("script"); 277 for( var i=data.length; i-->0; createLiTag(data[i]) ); 278 var _script = d.getElementsByTagName("script"); 287 279 _script[_script.length-1].parentNode.removeChild(_script[_script.length-1]); 288 } 280 }; 289 281 var createLiTag = function(obj){ 290 282 //check obj 291 283 var o = d.getElementById(obj.id); 292 if( o != null ){ return }; 284 if( o != null ){ return }; 285 286 var tl = document.getElementById("time_line"); 293 287 294 288 //create 295 var liTag = d.createElement("li");289 var liTag = tl.insertBefore(d.createElement("li"), null); 296 290 liTag.id = obj.id; 297 291 liTag.className = "unread"; 298 292 299 var imgDiv = d.createElement("div");293 var imgDiv = liTag.appendChild(d.createElement("div")); 300 294 imgDiv.className = "sub"; 301 295 imgDiv.id = "user_icon" 302 296 303 var imgTag = d.createElement("img");297 var imgTag = imgDiv.appendChild(d.createElement("img")); 304 298 imgTag.src = obj["user"]["profile_image_url"]; 305 299 imgTag.style.height = "16px"; 306 imgTag.style.width= "16px"; 307 imgDiv.appendChild(imgTag); 308 309 liTag.appendChild(imgDiv); 310 311 var nameDiv = d.createElement("div"); 300 imgTag.style.width = "16px"; 301 302 var nameDiv = liTag.appendChild(d.createElement("div")); 312 303 nameDiv.appendChild(d.createTextNode(obj["user"]["name"])); 313 304 nameDiv.className = "sub"; 314 305 315 var textDiv = d.createElement("div");306 var textDiv = liTag.appendChild(d.createElement("div")); 316 307 textDiv.appendChild(d.createTextNode(obj.text)); 317 308 textDiv.className = "sub text"; 318 319 liTag.appendChild(nameDiv); 320 liTag.appendChild(textDiv); 321 322 var tl = document.getElementById("time_line"); 323 tl.insertBefore(liTag, null); 324 } 309 }; 325 310 </script> 326 311 </head>
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)