diff --git a/build/bundle.js b/build/bundle.js index 5caca537..3a4910d2 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -9662,8 +9662,7 @@ exports.InteractiveRebaseView = InteractiveRebaseView; }); -require.define("/src/js/views/index.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError; -var _ = require('underscore'); +require.define("/src/js/views/index.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); var Q = require('q'); // horrible hack to get localStorage Backbone plugin var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone; @@ -9671,6 +9670,7 @@ var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window. var Main = require('../app'); var Constants = require('../util/constants'); var KeyboardListener = require('../util/keyboard').KeyboardListener; +var GitError = require('../util/errors').GitError; var BaseView = Backbone.View.extend({ getDestination: function() { @@ -16096,7 +16096,6 @@ var SeriesView = BaseView.extend({ // property changing but it's the 11th hour... var toLoop = this.$('div.levelIcon').each(function(index, el) { var id = $(el).attr('data-id'); - console.log('updating id', id); $(el).toggleClass('solved', Main.getLevelArbiter().isLevelSolved(id)); }); }, @@ -16920,6 +16919,97 @@ HeadlessGit.prototype.sendCommand = function(value) { exports.HeadlessGit = HeadlessGit; +}); + +require.define("/src/js/views/builderViews.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); +var Q = require('q'); +// horrible hack to get localStorage Backbone plugin +var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone; + +var util = require('../util'); +var KeyboardListener = require('../util/keyboard').KeyboardListener; + +var Views = require('../views'); +var ModalTerminal = Views.ModalTerminal; +var ContainedBase = Views.ContainedBase; + +var MarkdownGrabber = ContainedBase.extend({ + tagName: 'div', + className: 'MarkdownGrabber box horizontal', + template: _.template($('#markdown-grabber-view').html()), + events: { + 'keyup textarea': 'keyup' + }, + + initialize: function(options) { + options = options || {}; + this.deferred = options.deferred || Q.defer(); + this.options = options; + this.JSON = {}; + + this.container = new ModalTerminal({ + title: options.title || 'Enter some markdown' + }); + this.render(); + + if (!options.withoutButton) { + // do button stuff + var buttonDefer = Q.defer(); + buttonDefer.promise + .then(_.bind(function() { + this.confirmed(); + }, this)) + .fail(_.bind(function() { + this.cancelled(); + }, this)) + .done(); + var confirmCancel = new Views.ConfirmCancelView({ + deferred: buttonDefer, + destination: this.getDestination() + }); + } + + this.updatePreview(); + + if (!options.wait) { + this.show(); + } + }, + + confirmed: function() { + this.die(); + this.deferred.resolve(this.getRawText()); + }, + + cancelled: function() { + this.die(); + this.deferred.resolve(); + }, + + keyup: function() { + if (!this.throttledPreview) { + this.throttledPreview = _.throttle( + _.bind(this.updatePreview, this), + 500 + ); + } + this.throttledPreview(); + }, + + getRawText: function() { + return this.$('textarea').val(); + }, + + updatePreview: function() { + var raw = this.getRawText(); + var HTML = require('markdown').markdown.toHTML(raw); + this.$('div.insidePreview').html(HTML); + } +}); + +exports.MarkdownGrabber = MarkdownGrabber; + + }); require.define("/src/js/app/index.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); @@ -21031,7 +21121,8 @@ var toGlobalize = { Sandbox: require('../level/sandbox'), GitDemonstrationView: require('../views/gitDemonstrationView'), Markdown: require('markdown'), - LevelDropdownView: require('../views/levelDropdownView') + LevelDropdownView: require('../views/levelDropdownView'), + BuilderViews: require('../views/builderViews') }; _.each(toGlobalize, function(module) { @@ -21413,6 +21504,98 @@ exports.detectZoom = detectZoom; }); require("/src/js/util/zoomLevel.js"); +require.define("/src/js/views/builderViews.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); +var Q = require('q'); +// horrible hack to get localStorage Backbone plugin +var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone; + +var util = require('../util'); +var KeyboardListener = require('../util/keyboard').KeyboardListener; + +var Views = require('../views'); +var ModalTerminal = Views.ModalTerminal; +var ContainedBase = Views.ContainedBase; + +var MarkdownGrabber = ContainedBase.extend({ + tagName: 'div', + className: 'MarkdownGrabber box horizontal', + template: _.template($('#markdown-grabber-view').html()), + events: { + 'keyup textarea': 'keyup' + }, + + initialize: function(options) { + options = options || {}; + this.deferred = options.deferred || Q.defer(); + this.options = options; + this.JSON = {}; + + this.container = new ModalTerminal({ + title: options.title || 'Enter some markdown' + }); + this.render(); + + if (!options.withoutButton) { + // do button stuff + var buttonDefer = Q.defer(); + buttonDefer.promise + .then(_.bind(function() { + this.confirmed(); + }, this)) + .fail(_.bind(function() { + this.cancelled(); + }, this)) + .done(); + var confirmCancel = new Views.ConfirmCancelView({ + deferred: buttonDefer, + destination: this.getDestination() + }); + } + + this.updatePreview(); + + if (!options.wait) { + this.show(); + } + }, + + confirmed: function() { + this.die(); + this.deferred.resolve(this.getRawText()); + }, + + cancelled: function() { + this.die(); + this.deferred.resolve(); + }, + + keyup: function() { + if (!this.throttledPreview) { + this.throttledPreview = _.throttle( + _.bind(this.updatePreview, this), + 500 + ); + } + this.throttledPreview(); + }, + + getRawText: function() { + return this.$('textarea').val(); + }, + + updatePreview: function() { + var raw = this.getRawText(); + var HTML = require('markdown').markdown.toHTML(raw); + this.$('div.insidePreview').html(HTML); + } +}); + +exports.MarkdownGrabber = MarkdownGrabber; + + +}); +require("/src/js/views/builderViews.js"); + require.define("/src/js/views/commandViews.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); // horrible hack to get localStorage Backbone plugin var Backbone = (!require('../util').isBrowser()) ? Backbone = require('backbone') : Backbone = window.Backbone; @@ -22008,8 +22191,7 @@ exports.GitDemonstrationView = GitDemonstrationView; }); require("/src/js/views/gitDemonstrationView.js"); -require.define("/src/js/views/index.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError; -var _ = require('underscore'); +require.define("/src/js/views/index.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); var Q = require('q'); // horrible hack to get localStorage Backbone plugin var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone; @@ -22017,6 +22199,7 @@ var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window. var Main = require('../app'); var Constants = require('../util/constants'); var KeyboardListener = require('../util/keyboard').KeyboardListener; +var GitError = require('../util/errors').GitError; var BaseView = Backbone.View.extend({ getDestination: function() { @@ -22871,7 +23054,6 @@ var SeriesView = BaseView.extend({ // property changing but it's the 11th hour... var toLoop = this.$('div.levelIcon').each(function(index, el) { var id = $(el).attr('data-id'); - console.log('updating id', id); $(el).toggleClass('solved', Main.getLevelArbiter().isLevelSolved(id)); }); }, diff --git a/index.html b/index.html index e12c0909..c9572349 100644 --- a/index.html +++ b/index.html @@ -227,6 +227,26 @@ + + +