Move imageinput.js to capa_module js includes
This commit is contained in:
@@ -71,7 +71,8 @@ class CapaModule(XModule):
|
||||
'''
|
||||
icon_class = 'problem'
|
||||
|
||||
js = {'coffee': [resource_string(__name__, 'js/src/capa/display.coffee')]}
|
||||
js = {'coffee': [resource_string(__name__, 'js/src/capa/display.coffee')],
|
||||
'js': [resource_string(__name__, 'js/src/capa/imageinput.js')]}
|
||||
js_module_name = "Problem"
|
||||
|
||||
def __init__(self, system, location, definition, instance_state=None, shared_state=None, **kwargs):
|
||||
|
||||
24
common/lib/xmodule/xmodule/js/src/capa/imageinput.js
Normal file
24
common/lib/xmodule/xmodule/js/src/capa/imageinput.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Simple image input
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// click on image, return coordinates
|
||||
// put a dot at location of click, on imag
|
||||
|
||||
// window.image_input_click = function(id,event){
|
||||
|
||||
function image_input_click(id,event){
|
||||
iidiv = document.getElementById("imageinput_"+id);
|
||||
pos_x = event.offsetX?(event.offsetX):event.pageX-document.iidiv.offsetLeft;
|
||||
pos_y = event.offsetY?(event.offsetY):event.pageY-document.iidiv.offsetTop;
|
||||
result = "[" + pos_x + "," + pos_y + "]";
|
||||
cx = (pos_x-15) +"px";
|
||||
cy = (pos_y-15) +"px" ;
|
||||
// alert(result);
|
||||
document.getElementById("cross_"+id).style.left = cx;
|
||||
document.getElementById("cross_"+id).style.top = cy;
|
||||
document.getElementById("cross_"+id).style.visibility = "visible" ;
|
||||
document.getElementById("input_"+id).value =result;
|
||||
}
|
||||
Reference in New Issue
Block a user