From bfcd6f2565ecd55a45154fd41d85ef9956a7b71c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 3 Feb 2014 22:15:14 +0000 Subject: [PATCH] Added bootstrap markdown --- .../1.1.1/css/bootstrap-markdown.min.css | 1 + .../1.1.1/js/bootstrap-markdown.js | 1003 ++++++++++ .../1.1.3/css/bootstrap-markdown.min.css | 1 + .../1.1.3/js/bootstrap-markdown.js | 980 ++++++++++ .../1.1.4/css/bootstrap-markdown.min.css | 1 + .../1.1.4/css/bootstrap.min.css | 873 +++++++++ .../1.1.4/css/pygment_trac.css | 70 + .../1.1.4/css/stylesheet.css | 431 +++++ .../1.1.4/js/bootstrap-markdown.js | 993 ++++++++++ ajax/libs/bootstrap-markdown/1.1.4/js/main.js | 87 + .../bootstrap-markdown/1.1.4/js/markdown.js | 1616 +++++++++++++++++ .../1.1.4/js/to-markdown.js | 184 ++ .../2.0.0/css/bootstrap-markdown.min.css | 1 + .../2.0.0/js/bootstrap-markdown.js | 993 ++++++++++ .../2.1.0/css/bootstrap-markdown.min.css | 1 + .../2.1.0/js/bootstrap-markdown.js | 993 ++++++++++ .../2.1.1/css/bootstrap-markdown.min.css | 1 + .../2.1.1/js/bootstrap-markdown.js | 997 ++++++++++ ajax/libs/bootstrap-markdown/package.json | 21 + 19 files changed, 9247 insertions(+) create mode 100644 ajax/libs/bootstrap-markdown/1.1.1/css/bootstrap-markdown.min.css create mode 100644 ajax/libs/bootstrap-markdown/1.1.1/js/bootstrap-markdown.js create mode 100644 ajax/libs/bootstrap-markdown/1.1.3/css/bootstrap-markdown.min.css create mode 100644 ajax/libs/bootstrap-markdown/1.1.3/js/bootstrap-markdown.js create mode 100644 ajax/libs/bootstrap-markdown/1.1.4/css/bootstrap-markdown.min.css create mode 100644 ajax/libs/bootstrap-markdown/1.1.4/css/bootstrap.min.css create mode 100644 ajax/libs/bootstrap-markdown/1.1.4/css/pygment_trac.css create mode 100644 ajax/libs/bootstrap-markdown/1.1.4/css/stylesheet.css create mode 100644 ajax/libs/bootstrap-markdown/1.1.4/js/bootstrap-markdown.js create mode 100644 ajax/libs/bootstrap-markdown/1.1.4/js/main.js create mode 100644 ajax/libs/bootstrap-markdown/1.1.4/js/markdown.js create mode 100644 ajax/libs/bootstrap-markdown/1.1.4/js/to-markdown.js create mode 100644 ajax/libs/bootstrap-markdown/2.0.0/css/bootstrap-markdown.min.css create mode 100644 ajax/libs/bootstrap-markdown/2.0.0/js/bootstrap-markdown.js create mode 100644 ajax/libs/bootstrap-markdown/2.1.0/css/bootstrap-markdown.min.css create mode 100644 ajax/libs/bootstrap-markdown/2.1.0/js/bootstrap-markdown.js create mode 100644 ajax/libs/bootstrap-markdown/2.1.1/css/bootstrap-markdown.min.css create mode 100644 ajax/libs/bootstrap-markdown/2.1.1/js/bootstrap-markdown.js create mode 100644 ajax/libs/bootstrap-markdown/package.json diff --git a/ajax/libs/bootstrap-markdown/1.1.1/css/bootstrap-markdown.min.css b/ajax/libs/bootstrap-markdown/1.1.1/css/bootstrap-markdown.min.css new file mode 100644 index 000000000..be674d578 --- /dev/null +++ b/ajax/libs/bootstrap-markdown/1.1.1/css/bootstrap-markdown.min.css @@ -0,0 +1 @@ +.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.md-editor{display:block;border:1px solid #ddd}.md-editor>.md-header,.md-editor .md-footer{display:block;padding:6px 4px;background:#fff}.md-editor>.md-preview{background:#fff;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;min-height:10px}.md-editor>textarea{font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:14px;outline:0;outline:thin dotted \9;margin:0;display:block;padding:0;width:100%;border:0;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;border-radius:0;box-shadow:none;background:#eee}.md-editor>textarea:focus{box-shadow:none;background:#fff}.md-editor.active{-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s} \ No newline at end of file diff --git a/ajax/libs/bootstrap-markdown/1.1.1/js/bootstrap-markdown.js b/ajax/libs/bootstrap-markdown/1.1.1/js/bootstrap-markdown.js new file mode 100644 index 000000000..5731ce7bb --- /dev/null +++ b/ajax/libs/bootstrap-markdown/1.1.1/js/bootstrap-markdown.js @@ -0,0 +1,1003 @@ +/* =================================================== + * bootstrap-markdown.js v1.1.1 + * http://github.com/toopay/bootstrap-markdown + * =================================================== + * Copyright 2013 Taufan Aditya + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================== */ + +!function ($) { + + "use strict"; // jshint ;_; + + + /* MARKDOWN CLASS DEFINITION + * ========================== */ + + var Markdown = function (element, options) { + // Class Properties + this.$ns = 'bootstrap-markdown' + this.$element = $(element) + this.$editable = {el:null, type:null,attrKeys:[], attrValues:[], content:null} + this.$cloneEditor = {el:null, type:null,attrKeys:[], attrValues:[], content:null} + this.$options = $.extend(true, {}, $.fn.markdown.defaults, options) + this.$oldContent = null + this.$isPreview = false + this.$editor = null + this.$textarea = null + this.$handler = [] + this.$callback = [] + this.$nextTab = [] + + this.showEditor() + } + + Markdown.prototype = { + + constructor: Markdown + + , __alterButtons: function(name,alter) { + var handler = this.$handler, isAll = (name == 'all'),that = this + + $.each(handler,function(k,v) { + var halt = true + if (isAll) { + halt = false + } else { + halt = v.indexOf(name) < 0 + } + + if (halt == false) { + alter(that.$editor.find('button[data-handler="'+v+'"]')) + } + }) + } + + , __buildButtons: function(buttonsArray, container) { + var i, + ns = this.$ns, + handler = this.$handler, + callback = this.$callback + + for (i=0;i', { + 'class': 'btn-group' + }) + + for (z=0;z ' + +btnText + +'') + + // Register handler and callback + handler.push(buttonHandler) + callback.push(button.callback) + } + + // Attach the button group into container dom + container.append(btnGroupContainer) + } + } + + return container + } + , __setListener: function() { + // Set size and resizable Properties + var hasRows = typeof this.$textarea.attr('rows') != 'undefined', + maxRows = this.$textarea.val().split("\n").length > 5 ? this.$textarea.val().split("\n").length : '5', + rowsVal = hasRows ? this.$textarea.attr('rows') : maxRows + + this.$textarea.attr('rows',rowsVal) + this.$textarea.css('resize','none') + + this.$textarea + .on('focus', $.proxy(this.focus, this)) + .on('keypress', $.proxy(this.keypress, this)) + .on('keyup', $.proxy(this.keyup, this)) + + if (this.eventSupported('keydown')) { + this.$textarea.on('keydown', $.proxy(this.keydown, this)) + } + + // Re-attach markdown data + this.$textarea.data('markdown',this) + } + + , __handle: function(e) { + var target = $(e.currentTarget), + handler = this.$handler, + callback = this.$callback, + handlerName = target.attr('data-handler'), + callbackIndex = handler.indexOf(handlerName), + callbackHandler = callback[callbackIndex] + + // Trigger the focusin + $(e.currentTarget).focus() + + callbackHandler(this) + + // Unless it was the save handler, + // focusin the textarea + if (handlerName.indexOf('cmdSave') < 0) { + this.$textarea.focus() + } + + e.preventDefault() + } + + , showEditor: function() { + var instance = this, + textarea, + ns = this.$ns, + container = this.$element, + originalHeigth = container.css('height'), + originalWidth = container.css('width'), + editable = this.$editable, + handler = this.$handler, + callback = this.$callback, + options = this.$options, + editor = $( '
', { + 'class': 'md-editor', + click: function() { + instance.focus() + } + }) + + // Prepare the editor + if (this.$editor == null) { + // Create the panel + var editorHeader = $('
', { + 'class': 'md-header' + }) + + // Build the main buttons + if (options.buttons.length > 0) { + editorHeader = this.__buildButtons(options.buttons, editorHeader) + } + + // Build the additional buttons + if (options.additionalButtons.length > 0) { + editorHeader = this.__buildButtons(options.additionalButtons, editorHeader) + } + + editor.append(editorHeader) + + // Wrap the textarea + if (container.is('textarea')) { + container.before(editor) + textarea = container + textarea.addClass('md-input') + editor.append(textarea) + } else { + var rawContent = (typeof toMarkdown == 'function') ? toMarkdown(container.html()) : container.html(), + currentContent = $.trim(rawContent) + + // This is some arbitrary content that could be edited + textarea = $('