function showResponse() { $('#error_form').hide(); $('#sending').hide(); $('#responding').show(); } function showRequest() { $('#error_form').hide(); $('#responding').hide(); $('#sending').show(); } function colseErrorForm() { $.colorbox.close(); $('#sending').hide(); $('#responding').hide(); $('#error_form').show(); } $(function(){ var options = { beforeSubmit: showRequest, // pre-submit callback success: showResponse // post-submit callback }; $('#error_form').ajaxForm(options); }) BX.bind(document, "keypress", SendError); function SendError(event, formElem) { event = event || window.event; if((event.ctrlKey) && ((event.keyCode == 0xA)||(event.keyCode == 0xD))) { $('input[name=error_message]').val(getSelectedText()); $('input[name=error_url]').val(window.location); $('input[name=error_referer]').val(document.referrer); $('input[name=error_useragent]').val(navigator.userAgent); $('#sending').hide(); $('#responding').hide(); $('#error_form').show(); $.colorbox({inline:true, href:"#error_form_box"}); // var Dialog = new BX.CDialog({ // title: "You found an error in the text!!", // head: "What is the error?", // content: '
\ // \ // \ // \ // \ // \ //
', // resizable: false, // height: '198', // width: '400'}); // // Dialog.SetButtons([ // { // 'title': 'Send', // 'id': 'action_send', // 'name': 'action_send', // 'action': function(){ // BX.ajax.submit(BX("help_form")); // this.parentWindow.Close(); // } // }, // { // 'title': 'Cancel', // 'id': 'cancel', // 'name': 'cancel', // 'action': function(){ // this.parentWindow.Close(); // } // } // ]); // Dialog.Show(); } } function getSelectedText(){ if (window.getSelection){ txt = window.getSelection(); } else if (document.getSelection) { txt = document.getSelection(); } else if (document.selection){ txt = document.selection.createRange().text; } else return; return txt; }