index.js000644 0000011175 14553553126007367 0ustar00000000 000000 !function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";var n=this&&this.__awaiter||function(e,t,o,n){return new(o||(o=Promise))((function(i,r){function l(e){try{a(n.next(e))}catch(e){r(e)}}function u(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(l,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=o(1),r=o(2);i.default.plugins.register({onStart:function(){return n(this,void 0,void 0,(function*(){const e=i.default.views.dialogs,t=i.default.views.panels;let o="",l="";yield i.default.commands.register({name:"victor",label:"Delete all data...",execute:()=>n(this,void 0,void 0,(function*(){o||(o=yield e.create("confirmDialog")),yield e.setHtml(o,"

This will permanently delete all your data - all your notes, notebooks, attachments and tags. The data cannot be recovered.

Would you like to continue?

"),yield e.setButtons(o,[{id:"ok",title:"Delete all my data"},{id:"cancel"}]);if("cancel"===(yield e.open(o)).id)return;l||(l=yield t.create("logPanel")),yield t.setHtml(l,"");const r=["resources","notes","folders","tags","revisions"],u={resources:0,notes:0,folders:0,tags:0,revisions:0},a=e=>n(this,void 0,void 0,(function*(){const o=[`${e?"All items have been deleted.":"Deletion in progress..."}
`];for(const[e,t]of Object.entries(u))o.push(e+": "+t.toString());yield t.setHtml(l,'
'+o.join("
")+"
")})),s=[];for(const e of r)for(;;){let t=null;try{t=yield i.default.data.get([e],{page:1,fields:["id"],limit:50})}catch(t){if("revisions"===e){console.warn("Processing revisions table failed - it may not be supported by Joplin current version:",t);continue}throw t}u[e]+=t.items.length;const o=[];for(const n of t.items){if(s.includes(n.id))throw new Error("Trying to delete an item that has already been processed - aborting");s.push(n.id),o.push(yield i.default.data.delete([e,n.id]))}if(yield Promise.all(o),yield a(!1),!t.has_more)break}yield a(!0)}))}),yield i.default.views.menuItems.create("victor","victor",r.MenuItemLocation.Tools)}))}})},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=joplin},function(e,t,o){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ContentScriptType=t.SettingStorage=t.AppType=t.SettingItemType=t.ToolbarButtonLocation=t.isContextMenuItemLocation=t.MenuItemLocation=t.ImportModuleOutputFormat=t.FileSystemItem=void 0,function(e){e.File="file",e.Directory="directory"}(t.FileSystemItem||(t.FileSystemItem={})),function(e){e.Markdown="md",e.Html="html"}(t.ImportModuleOutputFormat||(t.ImportModuleOutputFormat={})),function(e){e.File="file",e.Edit="edit",e.View="view",e.Note="note",e.Tools="tools",e.Help="help",e.Context="context",e.NoteListContextMenu="noteListContextMenu",e.EditorContextMenu="editorContextMenu",e.FolderContextMenu="folderContextMenu",e.TagContextMenu="tagContextMenu"}(n=t.MenuItemLocation||(t.MenuItemLocation={})),t.isContextMenuItemLocation=function(e){return[n.Context,n.NoteListContextMenu,n.EditorContextMenu,n.FolderContextMenu,n.TagContextMenu].includes(e)},function(e){e.NoteToolbar="noteToolbar",e.EditorToolbar="editorToolbar"}(t.ToolbarButtonLocation||(t.ToolbarButtonLocation={})),function(e){e[e.Int=1]="Int",e[e.String=2]="String",e[e.Bool=3]="Bool",e[e.Array=4]="Array",e[e.Object=5]="Object",e[e.Button=6]="Button"}(t.SettingItemType||(t.SettingItemType={})),function(e){e.Desktop="desktop",e.Mobile="mobile",e.Cli="cli"}(t.AppType||(t.AppType={})),function(e){e[e.Database=1]="Database",e[e.File=2]="File"}(t.SettingStorage||(t.SettingStorage={})),function(e){e.MarkdownItPlugin="markdownItPlugin",e.CodeMirrorPlugin="codeMirrorPlugin"}(t.ContentScriptType||(t.ContentScriptType={}))}]);manifest.json000644 0000001442 14553553126010417 0ustar00000000 000000 { "manifest_version": 1, "id": "org.joplinapp.plugins.Victor", "app_min_version": "2.2", "version": "1.0.3", "name": "Victor", "description": "Victor can be used to clear all your data - notes, notebooks, attachments, tags, etc. Convenient to start over.", "author": "Laurent Cozic", "homepage_url": "https://github.com/joplin/plugin-victor#readme", "repository_url": "https://github.com/joplin/plugin-victor", "keywords": [], "categories": ["developer tools", "productivity"], "screenshots": [ { "src": "images/screenshot-1.png" }, { "src": "images/screenshot-2.png" } ], "icons": { "16": "images/icon-16.png", "32": "images/icon-32.png", "48": "images/icon-48.png", "128": "images/icon-128.png" }, "promo_tile": { "src": "images/promo_tile.png" } }