Changeset 139 for trunk/expressoMail1_2/js/shortcut.js
- Timestamp:
- 01/03/08 14:09:58 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/shortcut.js
r135 r139 224 224 225 225 /* ExpressMail Functions */ 226 var shift_up_count = 0; 227 var shift_down_count = 0; 226 228 shortcut.add("N",function(){ new_message("new","null"); },{'disable_in_input':true}); 227 shortcut.add("Esc",function(){ delete_border(get_msg_id(), 'false'); },{'disable_in_input':false}); 229 230 shortcut.add("Esc",function(){ 231 var window_closed = false; 232 for(var window in arrayJSWin) 233 { 234 if (arrayJSWin[window].visible) 235 { 236 arrayJSWin[window].close(); 237 window_closed = true; 238 } 239 } 240 if (!window_closed) 241 delete_border(get_msg_id(), 'false'); 242 },{'disable_in_input':false}); 243 228 244 shortcut.add("I",function(){ exec_msg_action('print'); },{'disable_in_input':true}); 229 245 shortcut.add("E",function(){ exec_msg_action('forward'); },{'disable_in_input':true}); … … 232 248 if ( Element('border_id_0').className==='menu-sel' ) 233 249 { 250 var selected_msgs = ''; 251 var current_folder = get_current_folder(); 252 all_messages = Element('tbody_box').childNodes; 253 254 for (var i=0; i < all_messages.length; i++) 255 if (all_messages[i].style.backgroundColor != '') 256 selected_msgs += all_messages[i].id + ','; 257 258 selected_msgs = selected_msgs.substring(0,(selected_msgs.length-1)); 259 delete_msgs(current_folder, selected_msgs, 'null'); 260 } 261 else 262 exec_msg_action('delete'); 263 } 264 ,{'disable_in_input':true}); 265 266 shortcut.add("Ctrl+Up",function(){ exec_msg_action('previous'); },{'disable_in_input':true}); 267 shortcut.add("Ctrl+Down",function(){ exec_msg_action('next'); },{'disable_in_input':true}); 268 if (is_ie){ 269 shortcut.add("down",function(){ select_msg('null', 'down'); },{'disable_in_input':false}); 270 shortcut.add("up",function(){ select_msg('null', 'up'); },{'disable_in_input':false}); 271 shortcut.add("Shift+down",function(){ 272 if (shift_up_count > 0) 273 unselect_top_msg(); 274 else 275 select_bottom_msg(); 276 },{'disable_in_input':false, 'propagate':false}); 277 shortcut.add("Shift+up",function(){ 278 if (shift_down_count > 0) 279 unselect_bottom_msg(); 280 else 281 select_top_msg(); 282 },{'disable_in_input':false, 'propagate':false}); 283 } 284 else{ 285 shortcut.add("down",function(){ select_msg('null', 'down'); },{'type':'keypress', 'disable_in_input':false}); 286 shortcut.add("up",function(){ select_msg('null', 'up'); },{'type':'keypress', 'disable_in_input':false}); 287 shortcut.add("Shift+down",function(){ 288 if (shift_up_count > 0) 289 unselect_top_msg(); 290 else 291 select_bottom_msg(); 292 },{'type':'keypress','disable_in_input':false, 'propagate':false}); 293 shortcut.add("Shift+up",function(){ 294 if (shift_down_count > 0) 295 unselect_bottom_msg(); 296 else 297 select_top_msg(); 298 },{'type':'keypress','disable_in_input':false, 'propagate':false}); 299 } 300 301 shortcut.add("return",function(){ 302 if ( Element('border_id_0').className==='menu-sel' ) 303 { 234 304 all_messages = Element('tbody_box').childNodes; 235 305 for (var i=0; i < all_messages.length; i++) … … 237 307 if (all_messages[i].style.backgroundColor != '') 238 308 { 239 delete_msgs(get_current_folder(), all_messages[i].id, 'null');240 return;241 }242 }243 }244 else245 exec_msg_action('delete');246 }247 ,{'disable_in_input':true});248 249 shortcut.add("Ctrl+Up",function(){ exec_msg_action('previous'); },{'disable_in_input':true});250 shortcut.add("Ctrl+Down",function(){ exec_msg_action('next'); },{'disable_in_input':true});251 252 shortcut.add("down",function(){ select_msg('null', 'down'); },{'disable_in_input':false});253 shortcut.add("up",function(){ select_msg('null', 'up'); },{'disable_in_input':false});254 255 shortcut.add("return",function(){256 if ( Element('border_id_0').className==='menu-sel' )257 {258 all_messages = Element('tbody_box').childNodes;259 for (var i=0; i < all_messages.length; i++)260 {261 if (all_messages[i].style.backgroundColor != '')262 {263 309 Element("td_who_" + all_messages[i].id).onclick(); 264 310 return; … … 269 315 ,{'disable_in_input':true}); 270 316 317 shortcut.add("f9",function(){ 318 Element("em_refresh_button").onclick(); 319 return; 320 },{'disable_in_input':true}); 271 321 272 322 function exec_msg_action(action) … … 300 350 function select_msg(msg_number, keyboard_action) 301 351 { 352 if ( Element('border_id_0').className != 'menu-sel' ) 353 return; 354 355 shift_up_count = 0; 356 shift_down_count = 0; 357 302 358 if (msg_number != 'null') 303 359 { … … 319 375 { 320 376 all_messages = Element('tbody_box').childNodes; 321 for (var i=0; i < all_messages.length; i++) 322 { 323 if (all_messages[i].style.backgroundColor != '') 324 { 325 if (keyboard_action == 'down') 377 if (keyboard_action == 'down') 378 { 379 if (all_messages[all_messages.length-1].style.backgroundColor != '') 380 return false; 381 382 for (var i=all_messages.length-1; i >=0; i--) 383 { 384 if (all_messages[i].style.backgroundColor != '') 326 385 { 327 if (i+1 <= all_messages.length-1) 328 { 329 all_messages[i].style.color = ''; 330 all_messages[i].style.backgroundColor = ''; 331 332 all_messages[i+1].style.color = 'white'; 333 all_messages[i+1].style.backgroundColor = '#5194d2'; 334 } 335 else 336 { 337 return false; 338 } 386 all_messages[i+1].style.color = 'white'; 387 all_messages[i+1].style.backgroundColor = '#5194d2'; 388 break; 339 389 } 340 else if ( (keyboard_action == 'up') && (i-1 >= 0) ) 390 } 391 for (; i>=0; i--) 392 { 393 all_messages[i].style.color = ''; 394 all_messages[i].style.backgroundColor = ''; 395 } 396 return true; 397 } 398 else 399 { 400 if (all_messages[0].style.backgroundColor != '') 401 return false; 402 403 for (var i=0; i < all_messages.length; i++) 404 { 405 if (all_messages[i].style.backgroundColor != '') 341 406 { 342 all_messages[i].style.color = '';343 all_messages[i].style.backgroundColor = '';344 345 407 all_messages[i-1].style.color = 'white'; 346 408 all_messages[i-1].style.backgroundColor = '#5194d2'; 347 } 348 return; 349 } 350 } 351 } 352 } 409 break; 410 } 411 } 412 for (; i< all_messages.length; i++) 413 { 414 all_messages[i].style.color = ''; 415 all_messages[i].style.backgroundColor = ''; 416 } 417 return true; 418 } 419 } 420 } 421 422 function select_bottom_msg() 423 { 424 all_messages = Element('tbody_box').childNodes; 425 426 if (all_messages[all_messages.length-1].style.backgroundColor != '') 427 return; 428 429 for (var i=all_messages.length-1; i >=0; i--) 430 { 431 if ((all_messages[i].style.backgroundColor != '') && (i+1 <= all_messages.length-1)) 432 { 433 shift_down_count++; 434 all_messages[i+1].style.color = 'white'; 435 all_messages[i+1].style.backgroundColor = '#5194d2'; 436 break; 437 } 438 } 439 } 440 441 function select_top_msg() 442 { 443 all_messages = Element('tbody_box').childNodes; 444 445 if (all_messages[0].style.backgroundColor != '') 446 return; 447 448 for (var i=0; i <=all_messages.length-1; i++) 449 { 450 if (all_messages[i].style.backgroundColor != '') 451 { 452 shift_up_count++; 453 all_messages[i-1].style.color = 'white'; 454 all_messages[i-1].style.backgroundColor = '#5194d2'; 455 break; 456 } 457 } 458 } 459 460 function unselect_bottom_msg() 461 { 462 all_messages = Element('tbody_box').childNodes; 463 for (var i=all_messages.length-1; i >=0; i--) 464 { 465 if (all_messages[i].style.backgroundColor != '') 466 { 467 shift_down_count--; 468 all_messages[i].style.color = ''; 469 all_messages[i].style.backgroundColor = ''; 470 break; 471 } 472 } 473 } 474 475 function unselect_top_msg() 476 { 477 all_messages = Element('tbody_box').childNodes; 478 for (var i=0; i <=all_messages.length-1; i++) 479 { 480 if (all_messages[i].style.backgroundColor != '') 481 { 482 shift_up_count--; 483 all_messages[i].style.color = ''; 484 all_messages[i].style.backgroundColor = ''; 485 break; 486 } 487 } 488 }
Note: See TracChangeset
for help on using the changeset viewer.