index.js000644 0000014430 14671357265007373 0ustar00000000 000000 (()=>{"use strict";var e={998:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=joplin},143:(e,t)=>{var a,n,o,i,r,l,c,m,d,u;Object.defineProperty(t,"__esModule",{value:!0}),t.ContentScriptType=t.SettingStorage=t.AppType=t.SettingItemSubType=t.SettingItemType=t.ToolbarButtonLocation=t.isContextMenuItemLocation=t.MenuItemLocation=t.ModelType=t.ImportModuleOutputFormat=t.FileSystemItem=void 0,(u=t.FileSystemItem||(t.FileSystemItem={})).File="file",u.Directory="directory",(d=t.ImportModuleOutputFormat||(t.ImportModuleOutputFormat={})).Markdown="md",d.Html="html",(m=t.ModelType||(t.ModelType={}))[m.Note=1]="Note",m[m.Folder=2]="Folder",m[m.Setting=3]="Setting",m[m.Resource=4]="Resource",m[m.Tag=5]="Tag",m[m.NoteTag=6]="NoteTag",m[m.Search=7]="Search",m[m.Alarm=8]="Alarm",m[m.MasterKey=9]="MasterKey",m[m.ItemChange=10]="ItemChange",m[m.NoteResource=11]="NoteResource",m[m.ResourceLocalState=12]="ResourceLocalState",m[m.Revision=13]="Revision",m[m.Migration=14]="Migration",m[m.SmartFilter=15]="SmartFilter",m[m.Command=16]="Command",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"}(a=t.MenuItemLocation||(t.MenuItemLocation={})),t.isContextMenuItemLocation=function(e){return[a.Context,a.NoteListContextMenu,a.EditorContextMenu,a.FolderContextMenu,a.TagContextMenu].includes(e)},(c=t.ToolbarButtonLocation||(t.ToolbarButtonLocation={})).NoteToolbar="noteToolbar",c.EditorToolbar="editorToolbar",(l=t.SettingItemType||(t.SettingItemType={}))[l.Int=1]="Int",l[l.String=2]="String",l[l.Bool=3]="Bool",l[l.Array=4]="Array",l[l.Object=5]="Object",l[l.Button=6]="Button",(r=t.SettingItemSubType||(t.SettingItemSubType={})).FilePathAndArgs="file_path_and_args",r.FilePath="file_path",r.DirectoryPath="directory_path",(i=t.AppType||(t.AppType={})).Desktop="desktop",i.Mobile="mobile",i.Cli="cli",(o=t.SettingStorage||(t.SettingStorage={}))[o.Database=1]="Database",o[o.File=2]="File",(n=t.ContentScriptType||(t.ContentScriptType={})).MarkdownItPlugin="markdownItPlugin",n.CodeMirrorPlugin="codeMirrorPlugin"},156:function(e,t,a){var n=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))((function(o,i){function r(e){try{c(n.next(e))}catch(e){i(e)}}function l(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(r,l)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=a(998),i=a(143),r=a(143);o.default.plugins.register({onStart:function(){return n(this,void 0,void 0,(function*(){function e(e){return n(this,void 0,void 0,(function*(){const t=yield o.default.commands.execute("selectedText");if(t){const a=`https://chatgpt.com/?model=gpt-4o&q=${encodeURIComponent(`${e} ${t}`)}`;console.info(`Opening URL: ${a}`),yield o.default.commands.execute("openItem",a)}else yield o.default.views.dialogs.showMessageBox("No text selected to search.")}))}yield o.default.settings.onChange((e=>n(this,void 0,void 0,(function*(){alert("Please restart Joplin")})))),yield o.default.settings.registerSection("Chat_GPT_Search",{label:"GPT Search Settings"}),yield o.default.settings.registerSettings({GPTSearchCommand1:{value:1,type:r.SettingItemType.Bool,section:"Chat_GPT_Search",public:!0,label:"1"},GPTSearchLabelExplain:{value:"Explain",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 1 Name"},GPTSearchKeywordExplain:{value:"explain",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 1 Keyword"},GPTSearchCommand2:{value:1,type:r.SettingItemType.Bool,section:"Chat_GPT_Search",public:!0,label:"2"},GPTSearchLabelWhatIs:{value:"What is",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 2 Name"},GPTSearchKeywordWhatIs:{value:"what is",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 2 Keyword"},GPTSearchCommand3:{value:1,type:r.SettingItemType.Bool,section:"Chat_GPT_Search",public:!0,label:"3"},GPTSearchLabelSummary:{value:"Summarize",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 3 Name"},GPTSearchKeywordSummary:{value:"summarize",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 3 Keyword"},GPTSearchCommand4:{value:1,type:r.SettingItemType.Bool,section:"Chat_GPT_Search",public:!0,label:"4"},GPTSearchLabelDefine:{value:"Define",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 4 Name"},GPTSearchKeywordDefine:{value:"define",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 4 Keyword"},GPTSearchCommand5:{value:1,type:r.SettingItemType.Bool,section:"Chat_GPT_Search",public:!0,label:"5"},GPTSearchLabelRelated:{value:"Find related info",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 5 Name"},GPTSearchKeywordRelated:{value:"related",type:r.SettingItemType.String,section:"Chat_GPT_Search",public:!0,label:"Command 5 Keyword"}});const t=[{name:"gptExplain",commandSetting:"GPTSearchCommand1",labelSetting:"GPTSearchLabelExplain",keywordSetting:"GPTSearchKeywordExplain"},{name:"gptWhatIs",commandSetting:"GPTSearchCommand2",labelSetting:"GPTSearchLabelWhatIs",keywordSetting:"GPTSearchKeywordWhatIs"},{name:"gptSummary",commandSetting:"GPTSearchCommand3",labelSetting:"GPTSearchLabelSummary",keywordSetting:"GPTSearchKeywordSummary"},{name:"gptDefine",commandSetting:"GPTSearchCommand4",labelSetting:"GPTSearchLabelDefine",keywordSetting:"GPTSearchKeywordDefine"},{name:"gptRelated",commandSetting:"GPTSearchCommand5",labelSetting:"GPTSearchLabelRelated",keywordSetting:"GPTSearchKeywordRelated"}];for(const a of t)yield o.default.commands.register({name:a.name,label:yield o.default.settings.value(a.labelSetting),execute:()=>n(this,void 0,void 0,(function*(){const t=yield o.default.settings.value(a.keywordSetting);yield e(t)}))}),(yield o.default.settings.value(a.commandSetting))&&(yield o.default.views.menuItems.create(`GPTSearch_${a.name}`,a.name,i.MenuItemLocation.EditorContextMenu))}))}})}},t={};!function a(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,a),i.exports}(156)})();manifest.json000644 0000001066 14671357265010430 0ustar00000000 000000 { "manifest_version": 1, "id": "Jopline-Plugin-Chat-GPT-Search", "app_min_version": "2.0", "version": "1.0.0", "name": "Chat GPT Search", "description": "Search selected text on GPT-4o model.", "author": "Bhashkar Gupta", "homepage_url": "https://github.com/BhashkarGupta/Jopline-Plugin-Chat-GPT-Search", "repository_url": "https://github.com/BhashkarGupta/Jopline-Plugin-Chat-GPT-Search", "keywords": ["gpt", "search", "context menu"], "joplin_min_version": "2.0", "categories": ["search"], "enable_api": true }