100 lines
2.7 KiB
Plaintext
Executable File
100 lines
2.7 KiB
Plaintext
Executable File
/**
|
|
* Mantener funciones en un solo formato
|
|
*/
|
|
var comaco = {
|
|
upperText:function(event, element){
|
|
var e = event || window.event;
|
|
var k = null;
|
|
if(e.which) k = e.which;
|
|
else if(e.keyCode) k = e.keyCode;
|
|
|
|
//Control para permitir ctrl+c, ctrl+v, ctrl+x
|
|
if(e.ctrlKey==true && k==99)
|
|
return true;
|
|
if(e.ctrlKey==true && k==118)
|
|
return true;
|
|
if(e.ctrlKey==true && k==120)
|
|
return true;
|
|
|
|
if(k==8 || k==16 || k==39 || k==37 || e.shiftKey){
|
|
return true;
|
|
}
|
|
|
|
$(element).addClass("m-upper-case");
|
|
var x = this.doGetCaretPosition(element);
|
|
element.value=element.value.toUpperCase();
|
|
this.doSetCaretPosition(element,x);
|
|
},
|
|
doGetCaretPosition: function(oField) {
|
|
var iCaretPos = 0;
|
|
if (document.selection) // IE Support
|
|
{
|
|
oField.focus();
|
|
var oSel = document.selection.createRange();
|
|
// Move selection start to 0 position
|
|
oSel.moveStart ('character', -oField.value.length);
|
|
// The caret position is selection length
|
|
iCaretPos = oSel.text.length;
|
|
}
|
|
else
|
|
if (oField.selectionStart || oField.selectionStart == '0') // Firefox support
|
|
iCaretPos = oField.selectionStart;
|
|
return (iCaretPos);
|
|
},
|
|
doSetCaretPosition: function (oField, iCaretPos)
|
|
{
|
|
if (document.selection) // IE Support
|
|
{
|
|
oField.focus();
|
|
var oSel = document.selection.createRange();
|
|
oSel.moveStart('character', -oField.value.length);
|
|
oSel.moveStart('character', iCaretPos);
|
|
oSel.moveEnd('character', 0);
|
|
oSel.select();
|
|
}
|
|
else
|
|
if (oField.selectionStart || oField.selectionStart == '0') // Firefox support
|
|
{
|
|
oField.selectionStart = iCaretPos;
|
|
oField.selectionEnd = iCaretPos;
|
|
oField.focus();
|
|
}
|
|
},
|
|
keyLocks: function (e)
|
|
{
|
|
var key;
|
|
if(window.event)
|
|
{
|
|
key = window.event.keyCode;
|
|
if(key == 116 || key == 122)
|
|
{
|
|
event.keyCode=0;
|
|
event.returnValue=false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
key = e.which;
|
|
if(key == 116||key == 122)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
$(document).ready(function () {
|
|
$('#container').layout({ applyDemoStyles: true,
|
|
north: {
|
|
closable: false,
|
|
resizable: false
|
|
}
|
|
, south: {
|
|
closable: false,
|
|
resizable: false
|
|
}
|
|
});
|
|
document.oncontextmenu = new Function("return false");
|
|
window.history.forward();
|
|
});
|