script.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Copyright (C) 2016 Jeremiah Orians
  2. * This file is part of stage0.
  3. *
  4. * stage0 is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * stage0 is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with stage0. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. $(document).ready(function () {
  18. if(window.location.href.indexOf("RUN") > -1) {
  19. setTimeout("location.reload(true);",500);
  20. }
  21. });
  22. $(function (){
  23. $(".Memory td").dblclick(function () {
  24. var OriginalContent = $(this).text();
  25. var row_index = $(this).parent().index('tr');
  26. var col_index = $(this).index('tr:eq('+ row_index + ') td');
  27. $(this).addClass("cellEditing");
  28. $(this).html("<input type='text' value='" + OriginalContent + "' />");
  29. $(this).children().first().focus();
  30. $(this).children().first().keypress(function (e) {
  31. if (e.which == 13) {
  32. var newContent = $(this).val();
  33. $(this).parent().text(newContent);
  34. $(this).parent().removeClass("cellEditing");
  35. window.location.href = "Memory?row=" + (row_index - 1) + ";col=" + (col_index - 1) + ";value=" + newContent;}
  36. });
  37. $(this).children().first().blur(function(){
  38. $(this).parent().text(OriginalContent);
  39. $(this).parent().removeClass("cellEditing");
  40. });
  41. });
  42. });
  43. $(function (){
  44. $(".Registers td").dblclick(function () {
  45. var OriginalContent = $(this).text();
  46. var UsefulContent = $(this).parent().find("td:nth-child(1)").text();
  47. $(this).addClass("cellEditing");
  48. $(this).html("<input type='text' value='" + OriginalContent + "' />");
  49. $(this).children().first().focus();
  50. $(this).children().first().keypress(function (e) {
  51. if (e.which == 13) {
  52. var newContent = $(this).val();
  53. $(this).parent().text(newContent);
  54. $(this).parent().removeClass("cellEditing");
  55. window.location.href = "Register?Reg=" + UsefulContent + ";value=" + newContent;}
  56. });
  57. $(this).children().first().blur(function(){
  58. $(this).parent().text(OriginalContent);
  59. $(this).parent().removeClass("cellEditing");
  60. });
  61. });
  62. });
  63. $(function (){
  64. $(".Debug td").dblclick(function () {
  65. var UsefulContent = $(this).parent().find("td:nth-child(1)").text();
  66. window.location.href = "DEBUG?Inst=" + UsefulContent;
  67. });
  68. });