From 9d032809a2a2e5173cc348bfa5fc301b0a1f85e4 Mon Sep 17 00:00:00 2001 From: life Date: Fri, 25 Dec 2015 10:49:18 +0800 Subject: [PATCH] delete old export pdf --- public/plugins/export_pdf_bak/plugin.js | 155 ---------------------- public/plugins/export_pdf_bak/plugin.json | 16 --- 2 files changed, 171 deletions(-) delete mode 100644 public/plugins/export_pdf_bak/plugin.js delete mode 100644 public/plugins/export_pdf_bak/plugin.json diff --git a/public/plugins/export_pdf_bak/plugin.js b/public/plugins/export_pdf_bak/plugin.js deleted file mode 100644 index 2de5a663..00000000 --- a/public/plugins/export_pdf_bak/plugin.js +++ /dev/null @@ -1,155 +0,0 @@ -/** - * 导出插件 - */ -define(function() { - var exportPdf = { - langs: { - 'en-us': { - 'export': 'Export PDF', - 'exportSuccess': 'PDF saved successful!', - 'exportFailure': 'PDF saved failure!', - 'notExists': 'Please sync your note to ther server firslty.', - 'localUser': 'Not support for local user' - }, - 'zh-cn': { - 'export': '导出PDF', - 'exportSuccess': 'PDF导出成功!', - 'exportFailure': 'PDF导出失败!', - 'notExists': '请先同步该笔记!', - 'localUser': '本地用户不支持导出PDF' - }, - 'zh-hk': { - 'export': '導出PDF', - 'exportSuccess': 'PDF導出成功!', - 'exportFailure': 'PDF導出失敗!', - 'notExists': '請先同步該筆記!', - 'localUser': '本地用戶不支持導出PDF' - } - }, - - _inited: false, - _input: null, - - init: function() { - var me = this; - - me._input = $(''); - $('#hiddenZone').append(me._input); - // 下载pdf输入框 - me._input.change(function() { - - }); - - me._inited = true; - }, - - exportPDF: function(note) { - var me = this; - if(!note) { - return; - } - - var name = note.Title ? note.Title + '.pdf' : getMsg('Untitled') + '.pdf'; - - window.downloadPdfPath = false; - if(!me._inited) { - me.init(); - } - - var closed = false; - var interval; - Api.loading.show('', {hasProgress: true, onClose: function () { - closed = true; - clearInterval(interval); - }}); - Api.loading.setProgress(1); - var progress = 1; - interval = setInterval(function () { - progress += 5; - if (progress > 90) { - progress = 90; - } - Api.loading.setProgress(progress); - }, 500); - - // 保存 - Api.noteService.exportPdf(note.NoteId, function(curPath, filename, msg) { - clearInterval(interval); - if (closed) { - return; - } - Api.loading.setProgress(99); - Api.loading.hide(); - - setTimeout(function() { - if(curPath) { - me.downloadPdfPath = curPath; - - Api.gui.dialog.showSaveDialog(Api.gui.getCurrentWindow(), {title: name, defaultPath: name}, function(targetPath) { - if(targetPath && me.downloadPdfPath) { - Api.fileService.download(me.downloadPdfPath, targetPath, function(ok, msg) { - if(ok) { - Notify.show({title: 'Info', body: getMsg('plugin.export_pdf.exportSuccess')}); - } else { - Notify.show({type: 'warning', title: 'Warning', body: getMsg('plugin.export_pdf.exportFailure')}); - } - }); - } - }); - - } else { - var m = ""; - if(msg == "noteNotExists") { - m = getMsg('plugin.export_pdf.notExists'); - } - - Notify.show({type: 'warning', title: 'Warning', body: getMsg('plugin.export_pdf.exportFailure') + m}); - } - }, 100); - }); - }, - - // 打开前要执行的 - onOpen: function() { - var me = this; - var gui = Api.gui; - - var menu = { - label: Api.getMsg('plugin.export_pdf.export'), - enabled: function(noteIds) { - if(UserInfo.IsLocal) { - return false; - } - if (noteIds && noteIds.length == 1) { - return true; - } - return false; - }, - click: (function() { - return function(noteIds) { - if (UserInfo.IsLocal) { - Notify.show({type: 'warning', title: 'Warning', body: getMsg('plugin.export_pdf.localUser')}); - return; - } - if (!noteIds || noteIds.length > 1) { - return; - } - Api.noteService.getNote(noteIds[0], function(note) { - me.exportPDF(note); - }); - } - })() - }; - Api.addExportMenu(menu); - }, - // 打开后 - onOpenAfter: function() { - }, - // 关闭时需要运行的 - onClose: function() { - } - }; - - return exportPdf; - -}); diff --git a/public/plugins/export_pdf_bak/plugin.json b/public/plugins/export_pdf_bak/plugin.json deleted file mode 100644 index b3f6ebc5..00000000 --- a/public/plugins/export_pdf_bak/plugin.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "theme", - "author": "life", - "authorUrl": "http://life.leanote.com", - "desc": "主题配置", - "langs": { - "en-us": { - "pluginName": "Dark", - "pluginDesc": "" - }, - "zh-cn": { - "pluginName": "暗", - "pluginDesc": "" - } - } -} \ No newline at end of file