🔨 refactor: remove unused code

This commit is contained in:
hacker-c 2025-03-17 21:17:20 +08:00
parent 43a60393c7
commit 28a8def24d
6 changed files with 5 additions and 34 deletions

View file

@ -10,7 +10,6 @@ This is an Obsidian plugin designed to open projects or files directly in GitHub
1. Download Release Files:
- main.js
- manifest.json
- styles.css (if applicable)
2. Copy Files to Plugin Folder:
Paste the downloaded files into your vaults plugin folder: `VaultFolder/.obsidian/plugins/open-in-github`
3. Enable the Plugin:

24
main.ts
View file

@ -35,8 +35,8 @@ export default class OpenInGitHubPlugin extends Plugin {
// add icon
addIcon(CONSTS.TITLE_ID, customIcon)
// Left open-in-github button
const ribbonIconEl = this.addRibbonIcon(CONSTS.TITLE_ID, CONSTS.TITLE, this.openGitHub)
// left open-in-github button
this.addRibbonIcon(CONSTS.TITLE_ID, CONSTS.TITLE, this.openGitHub)
// add file menu
this.registerEvent(
@ -61,28 +61,8 @@ export default class OpenInGitHubPlugin extends Plugin {
});
})
);
// Perform additional things with the ribbon
ribbonIconEl.addClass('my-plugin-ribbon-class')
// Bottom right open-file-in-github button
// This adds a status bar item to the bottom of the app. Does not work on mobile apps.
// const statusBarItemEl = this.addStatusBarItem();
// const parser = new DOMParser()
// const svgDoc = parser.parseFromString(customIcon(24, 80), 'image/svg+xml')
// const svgElement = svgDoc.documentElement as unknown as HTMLElement
// svgElement.setAttribute('width', '16');
// svgElement.setAttribute('height', '16');
// statusBarItemEl.appendChild(svgElement);
// statusBarItemEl.addEventListener('click', e => openGitHub(e, true))
// When registering intervals, this function will automatically clear the interval when the plugin is disabled.
this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000))
}
onunload() { }
async loadSettings() {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData())
}

View file

@ -1,7 +1,7 @@
{
"id": "open-in-github",
"name": "Open in GitHub",
"version": "1.0.0",
"version": "1.0.1",
"minAppVersion": "0.15.0",
"description": "Open the current project or file in github.com.",
"author": "Murphy Chen",

View file

@ -1,6 +1,6 @@
{
"name": "obsidian-sample-plugin",
"version": "1.0.0",
"version": "1.0.1",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {

View file

@ -1,8 +0,0 @@
/*
This CSS file will be included with your plugin, and
available in the app when your plugin is enabled.
If your plugin does not need CSS, delete this file.
*/

View file

@ -1,3 +1,3 @@
{
"1.0.0": "0.15.0"
"1.0.1": "0.15.0"
}