Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions common/lib/xmodule/xmodule/js/src/capa/imageinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ window.image_input_click = function(id,event){
iidiv = document.getElementById("imageinput_"+id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file the variables iidiv, pos_x, pos_y, result, cx, and cy are leaked into the global namespace. Make sure that they are declared locally.

pos_x = event.offsetX?(event.offsetX):event.pageX-iidiv.offsetLeft;
pos_y = event.offsetY?(event.offsetY):event.pageY-iidiv.offsetTop;
result = "[" + pos_x + "," + pos_y + "]";
result = "[" + Math.round(pos_x) + "," + Math.round(pos_y) + "]";
cx = (pos_x-15) +"px";
cy = (pos_y-15) +"px" ;
// alert(result);
cy = (pos_y-15) +"px";

document.getElementById("cross_"+id).style.left = cx;
document.getElementById("cross_"+id).style.top = cy;
document.getElementById("cross_"+id).style.visibility = "visible" ;
Expand Down