// This is a manifest file that'll be compiled into including all the files listed below. // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically // be included in the compiled file accessible from http://example.com/assets/application.js // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // the compiled file. // // = require jquery // = require jquery_ujs //= require bootstrap //= require populate //= require 'jquery.cookie' //= require 'jquery-ui-1.8.18.custom.min' $(document).ready(function(){ $("#short").live('click', function(event){ window.parent.frames["frameworkarea"].setAttribute('cols',0+',*'); $(this).html(""); $(this).attr("id","long"); }); $("#long").live('click', function(event){ window.parent.frames["frameworkarea"].setAttribute('cols',200+',*'); $(this).html(""); $(this).attr("id","short"); }); var pressedCtrl = false; $(document).keyup(function (e) { if(e.which == 17) pressedCtrl=false; }) $(document).keydown(function (e) { if(e.which == 17) pressedCtrl = true; //alert(e.which); if(e.which == 73 && pressedCtrl == true) { //Aqui vai o código e chamadas de funções para o ctrl+s window.location = $("#add").attr("href"); } if(e.which == 113) { //Aqui vai o código e chamadas de funções para o ctrl+s window.location = $("#add").attr("href"); } if(e.which == 115) { //Aqui vai o código e chamadas de funções para o ctrl+s window.location = $("#cancel").attr("href"); } if(e.which == 117) { //Aqui vai o código e chamadas de funções para o ctrl+s $("#submit").closest('form').submit() } if(e.which == 118) { //Aqui vai o código e chamadas de funções para o ctrl+s $("#search").closest('form').submit() } }); try { $("input:text:visible:first").focus(); } catch(err) { null; } try { $('input.ui-datepicker').datepicker(); //$('.datePicker').datepicker(); $(".datepicker_flexa").datepicker({ //mostrar select com mes e com ano(de 10 em 10) changeMonth: true, changeYear: true, //mostra a data em outros meses showOtherMonths: true, selectOtherMonths: true, //formato da data dateFormat: 'dd/mm/yy' }); } catch(err) { null; } $('.datepicker_flexa').keydown( function(evt) { var obj = this; if (evt.keyCode == 9){ ExitDate(obj); //evt.returnValue=false; //return false; } if ((evt.keyCode==48)||(evt.keyCode==49)||(evt.keyCode==50)||(evt.keyCode==51)||(evt.keyCode==52)||(evt.keyCode==53)||(evt.keyCode==54)||(evt.keyCode==55)||(evt.keyCode==56)||(evt.keyCode==57)||(evt.keyCode==96)||(evt.keyCode==97)||(evt.keyCode==98)||(evt.keyCode==99)||(evt.keyCode==100)||(evt.keyCode==101)||(evt.keyCode==102)||(evt.keyCode==103)||(evt.keyCode==104)||(evt.keyCode==105)) { if (obj.value.length==2){ obj.value = obj.value+"/"; } if (obj.value.length==5){ obj.value = obj.value+"/"; } if (obj.value.substr(0,2)>31){ alert("Data inválida!"); evt.returnValue=false; return false; } if (obj.value.substr(3,2)>12){ alert("Data inválida!"); evt.returnValue=false; return false; } }else if ((evt.keyCode!=8)&&(evt.keyCode!=46)&&(evt.keyCode!=9)&&(evt.keyCode!=37)&&(evt.keyCode!=38)&&(evt.keyCode!=39)&&(evt.keyCode!=40)){ evt.returnValue=false; return false; } });//fim do keydown $('.datepicker_flexa').change( function() { });//fim do change }); function ExitDate(obj) { if (((obj.value.length<8)&&(obj.value.length>0))||(obj.value.length==9)) { alert("Data inválida!"); obj.focus(); } if (obj.value.length==8) { if (obj.value.substr(6,2)<17) { obj.value = obj.value.substr(0,6)+"20"+obj.value.substr(6,2); } else { obj.value = obj.value.substr(0,6)+"19"+obj.value.substr(6,2); } } } //fim do arquivo flexa-themejs.js