Shlomi Fish avatar Shlomi Fish committed d04ce64

Add more.

Comments (0)

Files changed (1)

fc-solve/site/wml/src/js/web-fc-solve-ui.js

     });
 }
 
-function _webui_output_set_text(text) {
-    $("#output").val(text);
-
-    return;
-}
-
-function _is_one_based_checked() {
-    return $("#one_based").is(':checked');
-}
-
-function _one_based_process(text) {
-    return text.replace(/^Move[^\n]+$/mg, function (move_s) {
-        return move_s.replace(/(stack|freecell)( )(\d+)/g,
-            function (match, resource_s, sep_s, digit_s) {
-                return (resource_s + sep_s + (1 + parseInt(digit_s)));
-            }
-        );
-    });
+function _increment_move_indices(move_s) {
+    return move_s.replace(/(stack|freecell)( )(\d+)/g,
+        function (match, resource_s, sep_s, digit_s) {
+            return (resource_s + sep_s +
+                (1 + parseInt(digit_s))
+            );
+        }
+    );
 }
 
-
 var _pristine_output;
-function clear_output() {
-    return _webui_output_set_text('');
-}
 
 Class('FC_Solve_UI',
     {
             _was_iterations_count_exceeded: { is: rw, init: false },
         },
         methods: {
+            _is_one_based_checked: function() {
+                return $("#one_based").is(':checked');
+            },
+            _webui_output_set_text: function(text) {
+                $("#output").val(text);
+
+                return;
+            },
+            _one_based_process: function (text) {
+                return text.replace(/^Move[^\n]+$/mg, _increment_move_indices);
+            },
             _process_pristine_output: function(text) {
-                return (_is_one_based_checked()
-                    ? _one_based_process(text)
+                var that = this;
+
+                return (that._is_one_based_checked()
+                    ? that._one_based_process(text)
                     : text
                 );
             },
             _update_output: function () {
                 var that = this;
 
-                _webui_output_set_text(
+                that._webui_output_set_text(
                     that._process_pristine_output(_pristine_output)
                 );
                 return;
     return;
 }
 
+function clear_output() {
+    return fcs_ui._webui_output_set_text('');
+}
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.