From 95d64d5c5392f1d6ea7efd35e457259f7821f806 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Fri, 14 Aug 2015 15:54:58 -0700 Subject: [PATCH] start clening things up into functions --- notebook/static/notebook/js/actions.js | 279 ++++++++++++++----------- 1 file changed, 155 insertions(+), 124 deletions(-) diff --git a/notebook/static/notebook/js/actions.js b/notebook/static/notebook/js/actions.js index 0f73e24cd..151833179 100644 --- a/notebook/static/notebook/js/actions.js +++ b/notebook/static/notebook/js/actions.js @@ -4,15 +4,17 @@ define(function(require){ "use strict"; + var dialog = require('base/js/dialog'); + var ActionHandler = function (env) { this.env = env || {}; Object.seal(this); }; - + function escapeRegExp(string){ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } - + /** * Give a `needle` string, find all occurences of `needle` ins it * and return an array of [][start, stop], ...] non-overlapping indexes. @@ -21,7 +23,7 @@ define(function(require){ var findAll = function(needle, haystack, caseinsensitive){ if(!needle){ return []; - + } if(caseinsensitive){ needle = needle.toLowerCase(); @@ -30,7 +32,7 @@ define(function(require){ var result = []; for(var j=0; j< haystack.length; j++){ var next = haystack.indexOf(needle, j); - + if(next === -1){ break; } else{ @@ -40,7 +42,7 @@ define(function(require){ } return result; }; - + /** * A bunch of predefined `Simple Actions` used by Jupyter. @@ -388,7 +390,7 @@ define(function(require){ .css('border-radius', '0') .css('border-left', 'none') .text('.*'); - + var isCaseSensitiveButton = $('