/*! * Goto line dialog plugin for Editor.md * * @file goto-line-dialog.js * @author pandao * @version 1.2.1 * @updateTime 2015-06-09 * {@link https://github.com/pandao/editor.md} * @license MIT */ (function() { var factory = function (exports) { var $ = jQuery; var pluginName = "goto-line-dialog"; var langs = { "zh-cn" : { toolbar : { "goto-line" : "跳转到行" }, dialog : { "goto-line" : { title : "跳转到行", label : "请输入行号", error : "错误:" } } }, "zh-tw" : { toolbar : { "goto-line" : "跳轉到行" }, dialog : { "goto-line" : { title : "跳轉到行", label : "請輸入行號", error : "錯誤:" } } }, "en" : { toolbar : { "goto-line" : "Goto line" }, dialog : { "goto-line" : { title : "Goto line", label : "Enter a line number, range ", error : "Error: " } } } }; exports.fn.gotoLineDialog = function() { var _this = this; var cm = this.cm; var editor = this.editor; var settings = this.settings; var path = settings.pluginPath + pluginName +"/"; var classPrefix = this.classPrefix; var dialogName = classPrefix + pluginName, dialog; $.extend(true, this.lang, langs[this.lang.name]); this.setToolbar(); var lang = this.lang; var dialogLang = lang.dialog["goto-line"]; var lineCount = cm.lineCount(); dialogLang.error += dialogLang.label + " 1-" + lineCount; if (editor.find("." + dialogName).length < 1) { var dialogContent = [ "
" + dialogLang.label + " 1-" + lineCount +"
", "