[ Index ] |
PHP Cross Reference of MyBB |
[Summary view] [Print] [Text view]
1 var MyCodeSandbox = Class.create(); 2 3 MyCodeSandbox.prototype = { 4 5 url: null, 6 button: null, 7 regex_textbox: null, 8 replacement_textbox: null, 9 test_textbox: null, 10 html_textbox: null, 11 actual_div: null, 12 spinnerImage: "../images/spinner_big.gif", 13 14 initialize: function(url, button, regex_textbox, replacement_textbox, test_textbox, html_textbox, actual_div) 15 { 16 if(button && regex_textbox && replacement_textbox && test_textbox && html_textbox && actual_div) 17 { 18 this.url = url; 19 this.button = button; 20 this.regex_textbox = regex_textbox; 21 this.replacement_textbox = replacement_textbox; 22 this.test_textbox = test_textbox; 23 this.html_textbox = html_textbox; 24 this.actual_div = actual_div; 25 26 Event.observe(button, "click", this.update.bindAsEventListener(this)); 27 } 28 }, 29 30 update: function(e) 31 { 32 Event.stop(e); 33 postData = "regex="+encodeURIComponent(this.regex_textbox.value)+"&replacement="+encodeURIComponent(this.replacement_textbox.value)+"&test_value="+encodeURIComponent(this.test_textbox.value)+"&my_post_key="+encodeURIComponent(my_post_key); 34 35 this.spinner = new ActivityIndicator("body", {image: this.spinnerImage}); 36 37 new Ajax.Request(this.url, { 38 method: 'post', 39 postBody: postData, 40 onComplete: this.onComplete.bind(this) 41 }); 42 }, 43 44 onComplete: function(request) 45 { 46 if(request.responseText.match(/<error>(.*)<\/error>/)) 47 { 48 message = request.responseText.match(/<error>(.*)<\/error>/); 49 50 if(!message[1]) 51 { 52 message[1] = "An unknown error occurred."; 53 } 54 55 alert('There was an error fetching the test results.\n\n'+message[1]); 56 } 57 else if(request.responseText) 58 { 59 this.actual_div.innerHTML = request.responseText; 60 this.html_textbox.value = request.responseText; 61 } 62 63 this.spinner.destroy(); 64 65 return true; 66 } 67 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Oct 8 19:19:50 2013 | Cross-referenced by PHPXref 0.7.1 |