Commit b4eefc64 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Javascript fixes

Showing with 34 additions and 41 deletions
+34 -41
...@@ -37,10 +37,8 @@ function chk_set_all_by_class(regex,value) ...@@ -37,10 +37,8 @@ function chk_set_all_by_class(regex,value)
{ {
for (var i = 0; i < document.mainform.elements.length; i++) { for (var i = 0; i < document.mainform.elements.length; i++) {
var _class = document.mainform.elements[i].getAttribute("class"); var _class = document.mainform.elements[i].getAttribute("class");
if(_class) { if(_class && _class.match(regex)) {
if(_class.match(regex)) { document.mainform.elements[i].checked = value;
document.mainform.elements[i].checked = value;
}
} }
} }
} }
...@@ -271,47 +269,42 @@ function move_div_by_cursor(e) ...@@ -271,47 +269,42 @@ function move_div_by_cursor(e)
var dialog; var dialog;
if ((enable_move_div_by_cursor !== undefined) && (enable_move_div_by_cursor === true)) { if ((enable_move_div_by_cursor === true) && document.getElementById('current_msg_dialogs')) {
/* Get mouse position on screen */
if (document.getElementById('current_msg_dialogs')) { if (window.event) {
event = window.event;
/* Get mouse position on screen mouse_pos_x = event.clientX;
*/ mouse_pos_y = event.clientY;
if (window.event) { } else if (e) {
event = window.event; event = e;
mouse_pos_x = event.clientX; mouse_pos_x = event.screenX;
mouse_pos_y = event.clientY; mouse_pos_y = event.screenY;
} else if (e) { } else {
event = e; return;
mouse_pos_x = event.screenX; }
mouse_pos_y = event.screenY;
} else {
return;
}
/* Get id of current msg_dialog */
cur_id = document.getElementById('current_msg_dialogs').value;
if (cur_id !== "") {
dialog = document.getElementById('e_layer' + cur_id);
/* Calculate new position */ /* Get id of current msg_dialog */
cur_div_x = mouse_pos_x - div_offset_x; cur_id = document.getElementById('current_msg_dialogs').value;
cur_div_y = mouse_pos_y - div_offset_y; if (cur_id !== "") {
dialog = document.getElementById('e_layer' + cur_id);
/* Ensure that dialog can't be moved out of screen */ /* Calculate new position */
if (cur_div_x < 0 ) { cur_div_x = mouse_pos_x - div_offset_x;
cur_div_x = 0; cur_div_y = mouse_pos_y - div_offset_y;
}
if (cur_div_y < 0 ) {
cur_div_y = 0;
}
/* Assign new values */ /* Ensure that dialog can't be moved out of screen */
dialog.style.left = (cur_div_x ) + "px"; if (cur_div_x < 0 ) {
dialog.style.top = (cur_div_y ) + "px"; cur_div_x = 0;
dialog.style.margin = "0"; }
dialog.style.position = "absolute"; if (cur_div_y < 0 ) {
cur_div_y = 0;
} }
/* Assign new values */
dialog.style.left = (cur_div_x ) + "px";
dialog.style.top = (cur_div_y ) + "px";
dialog.style.margin = "0";
dialog.style.position = "absolute";
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment