index.js000644 0000011140 14626242700007351 0ustar00000000 000000 !function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=joplin},function(t,e,n){"use strict";var o;Object.defineProperty(e,"__esModule",{value:!0}),e.ContentScriptType=e.SettingStorage=e.AppType=e.SettingItemSubType=e.SettingItemType=e.ToolbarButtonLocation=e.isContextMenuItemLocation=e.MenuItemLocation=e.ModelType=e.ImportModuleOutputFormat=e.FileSystemItem=void 0,function(t){t.File="file",t.Directory="directory"}(e.FileSystemItem||(e.FileSystemItem={})),function(t){t.Markdown="md",t.Html="html"}(e.ImportModuleOutputFormat||(e.ImportModuleOutputFormat={})),function(t){t[t.Note=1]="Note",t[t.Folder=2]="Folder",t[t.Setting=3]="Setting",t[t.Resource=4]="Resource",t[t.Tag=5]="Tag",t[t.NoteTag=6]="NoteTag",t[t.Search=7]="Search",t[t.Alarm=8]="Alarm",t[t.MasterKey=9]="MasterKey",t[t.ItemChange=10]="ItemChange",t[t.NoteResource=11]="NoteResource",t[t.ResourceLocalState=12]="ResourceLocalState",t[t.Revision=13]="Revision",t[t.Migration=14]="Migration",t[t.SmartFilter=15]="SmartFilter",t[t.Command=16]="Command"}(e.ModelType||(e.ModelType={})),function(t){t.File="file",t.Edit="edit",t.View="view",t.Note="note",t.Tools="tools",t.Help="help",t.Context="context",t.NoteListContextMenu="noteListContextMenu",t.EditorContextMenu="editorContextMenu",t.FolderContextMenu="folderContextMenu",t.TagContextMenu="tagContextMenu"}(o=e.MenuItemLocation||(e.MenuItemLocation={})),e.isContextMenuItemLocation=function(t){return[o.Context,o.NoteListContextMenu,o.EditorContextMenu,o.FolderContextMenu,o.TagContextMenu].includes(t)},function(t){t.NoteToolbar="noteToolbar",t.EditorToolbar="editorToolbar"}(e.ToolbarButtonLocation||(e.ToolbarButtonLocation={})),function(t){t[t.Int=1]="Int",t[t.String=2]="String",t[t.Bool=3]="Bool",t[t.Array=4]="Array",t[t.Object=5]="Object",t[t.Button=6]="Button"}(e.SettingItemType||(e.SettingItemType={})),function(t){t.FilePathAndArgs="file_path_and_args",t.FilePath="file_path",t.DirectoryPath="directory_path"}(e.SettingItemSubType||(e.SettingItemSubType={})),function(t){t.Desktop="desktop",t.Mobile="mobile",t.Cli="cli"}(e.AppType||(e.AppType={})),function(t){t[t.Database=1]="Database",t[t.File=2]="File"}(e.SettingStorage||(e.SettingStorage={})),function(t){t.MarkdownItPlugin="markdownItPlugin",t.CodeMirrorPlugin="codeMirrorPlugin"}(e.ContentScriptType||(e.ContentScriptType={}))},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function u(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}l((o=o.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(1),u=n(3);i.default.plugins.register({onStart:function(){return o(this,void 0,void 0,(function*(){u.default(),yield i.default.contentScripts.register(r.ContentScriptType.MarkdownItPlugin,"TimelineRule","./TimelineRule.js")}))}})},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function u(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}l((o=o.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const i=n(0),r=n(1);e.default=()=>o(void 0,void 0,void 0,(function*(){yield i.default.settings.registerSection("timeline",{label:"Timeline",iconName:"fas fa-clock"}),yield i.default.settings.registerSettings({timeformat:{value:"2023-2-3",type:r.SettingItemType.String,isEnum:!0,section:"timeline",public:!0,label:"time format",options:{"YYYY-MM-DD":"YYYY-MM-DD","DD-MM-YYYY":"DD-MM-YYYY"}}})}))}]);manifest.json000644 0000000703 14626242700010410 0ustar00000000 000000 { "manifest_version": 1, "id": "joplin-plugin-TimelineRender", "app_min_version": "2.8", "version": "1.1.0", "name": "joplin-plugin-TimelineRender", "description": "render the timeline in the markdown", "author": "funny-cat", "homepage_url": "https://discourse.joplinapp.org/t/new-plugin-timeline/29408", "repository_url": "https://github.com/funny-cat-happy/joplin-plugin-TimelineRender.git", "keywords": [], "categories": [] }Timeline.css000644 0000003724 14626242700010175 0ustar00000000 000000 .timeline-container { margin: auto; height: auto; overflow: hidden; display: flex; flex-direction: column; padding: 0; --left: 70px; --color: #0d5dff; } .timeline-item { position: relative; height: auto; width: 100%; } .timeline-item::before { content: ""; position: absolute; left: var(--left); width: 8px; top: 15px; bottom: 0px; background-image: linear-gradient( to bottom, rgba(144, 156, 173, 0.2) 60%, rgba(144, 156, 173, 0.2) 60% ); background-position: left; background-size: 8px 5px; background-repeat: repeat-y; } .timeline-dot-past { left: var(--left); width: 15px; height: 15px; position: absolute; border-radius: 50%; box-shadow: 0 0 0 1px #d8d8d8; background: #36bb14; text-align: center; top: 1px; line-height: 40px; margin-left: -3.5px; } .timeline-dot-current { left: var(--left); width: 15px; height: 15px; position: absolute; border-radius: 50%; box-shadow: 0 0 0 1px #d8d8d8; background: #f0a80d; text-align: center; top: 0; line-height: 40px; margin-left: -3.5px; } .timeline-dot-future { left: var(--left); width: 15px; height: 15px; position: absolute; border-radius: 50%; box-shadow: 0 0 0 1px #d8d8d8; background: #f55104; text-align: center; top: 0; line-height: 40px; margin-left: -3.5px; } .timeline-left { display: block; width: calc(var(--left) - 7px); height: 100%; position: absolute; margin-top: -5px; color: #8492a5; } .timeline-left p{ margin-top: 2px; font-size: 12px; } .timeline-right { position: relative; margin: 22px 0px 10px calc(var(--left) + 36px); font: 15px Tahoma,Helvetica,Arial,'宋体',sans-serif; } .timeline-right p{ margin: 0px 0px; }TimelineRule.js000644 0000004611 14626242704010651 0ustar00000000 000000 exports.default=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return{plugin:function(e,t){const n=e.renderer.rules.fence||function(e,t,n,r,i){return i.renderToken(e,t,n,r,i)};e.renderer.rules.fence=function(i,u,l,a,o){const c=i[u];if("timeline"!==c.info)return n(i,u,l,a,o);let s=e.utils.escapeHtml(c.content).split(/\n\s*\n/g),d=document.createElement("div");d.className="timeline-container";for(let n=0;n${a}

`,i.appendChild(l);let o=document.createElement("div");o.className="timeline-dot-current";const c=r(a,t.settingValue("timeformat"));"future"===c?o.className="timeline-dot-future":"past"===c&&(o.className="timeline-dot-past"),i.appendChild(o);let f=document.createElement("div");f.className="timeline-right",f.innerHTML=e.render(s[n].substring(u+1)),i.appendChild(f),d.appendChild(i)}}return d.outerHTML}},assets:function(){return[{name:"Timeline.css"}]}}};const r=(e,t)=>{try{let n;e=e.split("-"),"YYYY-MM-DD"===t?n=new Date(Date.UTC(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2]))):"DD-MM-YYYY"===t&&(n=new Date(Date.UTC(parseInt(e[2]),parseInt(e[1])-1,parseInt(e[0]))));let r=new Date;return r=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate())),n>r?"future":n