-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Entire Quran, Renamed Quran Folder to Quran Related, Added Defi…
…nitions
- Loading branch information
Showing
6,284 changed files
with
44,076 additions
and
59 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
const {Plugin, Notice, debounce} = require("obsidian"); | ||
const fs = require("fs"); | ||
|
||
const watchNeeded = window.process.platform !== "darwin" && window.process.platform !== "win32"; | ||
|
||
module.exports = class HotReload extends Plugin { | ||
|
||
statCache = new Map(); // path -> Stat | ||
queue = Promise.resolve(); | ||
|
||
run(val, err) { | ||
return this.queue = this.queue.then(val, err); | ||
} | ||
|
||
reindexPlugins = debounce(() => this.run(() => this.getPluginNames()), 500, true); | ||
requestScan = debounce(() => this.run(() => this.checkVersions()), 250, true); | ||
|
||
onload() { | ||
app.workspace.onLayoutReady(async ()=> { | ||
this.pluginReloaders = {}; | ||
this.inProgress = null; | ||
await this.getPluginNames(); | ||
this.registerEvent( this.app.vault.on("raw", this.requestScan)); | ||
this.watch(this.app.plugins.getPluginFolder()); | ||
this.requestScan(); | ||
this.addCommand({ | ||
id: "scan-for-changes", | ||
name: "Check plugins for changes and reload them", | ||
callback: () => this.requestScan() | ||
}) | ||
}); | ||
} | ||
|
||
watch(path) { | ||
if (this.app.vault.adapter.watchers.hasOwnProperty(path)) return; | ||
const realPath = [this.app.vault.adapter.basePath, path].join("/"); | ||
const lstat = fs.lstatSync(realPath, {throwIfNoEntry: false}); | ||
if (lstat && (watchNeeded || lstat.isSymbolicLink()) && fs.statSync(realPath).isDirectory()) { | ||
this.app.vault.adapter.startWatchPath(path, false); | ||
} | ||
} | ||
|
||
async checkVersions() { | ||
const base = this.app.plugins.getPluginFolder(); | ||
for (const dir of Object.keys(this.pluginNames)) { | ||
for (const file of ["manifest.json", "main.js", "styles.css", ".hotreload"]) { | ||
const path = `${base}/${dir}/${file}`; | ||
const stat = await app.vault.adapter.stat(path); | ||
if (stat) { | ||
if (this.statCache.has(path) && stat.mtime !== this.statCache.get(path).mtime) { | ||
this.onFileChange(path); | ||
} | ||
this.statCache.set(path, stat); | ||
} | ||
} | ||
} | ||
} | ||
|
||
async getPluginNames() { | ||
const plugins = {}, enabled = new Set(); | ||
for (const {id, dir} of Object.values(app.plugins.manifests)) { | ||
this.watch(dir); | ||
plugins[dir.split("/").pop()] = id; | ||
if ( | ||
await this.app.vault.exists(dir+"/.git") || | ||
await this.app.vault.exists(dir+"/.hotreload") | ||
) enabled.add(id); | ||
} | ||
this.pluginNames = plugins; | ||
this.enabledPlugins = enabled; | ||
} | ||
|
||
onFileChange(filename) { | ||
if (!filename.startsWith(this.app.plugins.getPluginFolder()+"/")) return; | ||
const path = filename.split("/"); | ||
const base = path.pop(), dir = path.pop(); | ||
if (path.length === 1 && dir === "plugins") return this.watch(filename); | ||
if (path.length != 2) return; | ||
const plugin = dir && this.pluginNames[dir]; | ||
if (base === "manifest.json" || base === ".hotreload" || base === ".git" || !plugin) return this.reindexPlugins(); | ||
if (base !== "main.js" && base !== "styles.css") return; | ||
if (!this.enabledPlugins.has(plugin)) return; | ||
const reloader = this.pluginReloaders[plugin] || ( | ||
this.pluginReloaders[plugin] = debounce(() => this.run(() => this.reload(plugin), console.error), 750, true) | ||
); | ||
reloader(); | ||
} | ||
|
||
async reload(plugin) { | ||
const plugins = app.plugins; | ||
|
||
// Don't reload disabled plugins | ||
if (!plugins.enabledPlugins.has(plugin)) return; | ||
|
||
await plugins.disablePlugin(plugin); | ||
console.debug("disabled", plugin); | ||
|
||
// Ensure sourcemaps are loaded (Obsidian 14+) | ||
const oldDebug = localStorage.getItem("debug-plugin"); | ||
localStorage.setItem("debug-plugin", "1"); | ||
try { | ||
await plugins.enablePlugin(plugin); | ||
} finally { | ||
// Restore previous setting | ||
if (oldDebug === null) localStorage.removeItem("debug-plugin"); else localStorage.setItem("debug-plugin", oldDebug); | ||
} | ||
console.debug("enabled", plugin); | ||
new Notice(`Plugin "${plugin}" has been reloaded`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"id": "hot-reload", | ||
"name": "Hot Reload", | ||
"author": "PJ Eby", | ||
"authorUrl": "https://github.com/pjeby", | ||
"version": "0.1.11", | ||
"minAppVersion": "0.15.9", | ||
"description": "Automatically reload in-development plugins when their files are changed", | ||
"isDesktopOnly": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD | ||
if you want to view the source, please visit the github repository of this plugin | ||
*/ | ||
|
||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
|
||
// main.ts | ||
var main_exports = {}; | ||
__export(main_exports, { | ||
default: () => MyPlugin | ||
}); | ||
module.exports = __toCommonJS(main_exports); | ||
var import_obsidian = require("obsidian"); | ||
var DEFAULT_SETTINGS = { | ||
mySetting: "default" | ||
}; | ||
var MyPlugin = class extends import_obsidian.Plugin { | ||
async onload() { | ||
await this.loadSettings(); | ||
const ribbonIconEl = this.addRibbonIcon("dice", "Sample Plugin", (evt) => { | ||
new import_obsidian.Notice("This is a notice!"); | ||
}); | ||
ribbonIconEl.addClass("my-plugin-ribbon-class"); | ||
const statusBarItemEl = this.addStatusBarItem(); | ||
statusBarItemEl.setText("Status Bar Text"); | ||
this.addCommand({ | ||
id: "open-sample-modal-simple", | ||
name: "Open sample modal (simple)", | ||
callback: () => { | ||
new SampleModal(this.app).open(); | ||
} | ||
}); | ||
this.addCommand({ | ||
id: "sample-editor-command", | ||
name: "Sample editor command", | ||
editorCallback: (editor, view) => { | ||
console.log(editor.getSelection()); | ||
editor.replaceSelection("Sample Editor Command"); | ||
} | ||
}); | ||
this.addCommand({ | ||
id: "open-sample-modal-complex", | ||
name: "Open sample modal (complex)", | ||
checkCallback: (checking) => { | ||
const markdownView = this.app.workspace.getActiveViewOfType(import_obsidian.MarkdownView); | ||
if (markdownView) { | ||
if (!checking) { | ||
new SampleModal(this.app).open(); | ||
} | ||
return true; | ||
} | ||
} | ||
}); | ||
this.addSettingTab(new SampleSettingTab(this.app, this)); | ||
this.registerDomEvent(document, "click", (evt) => { | ||
console.log("click", evt); | ||
}); | ||
this.registerInterval(window.setInterval(() => console.log("setInterval"), 5 * 60 * 1e3)); | ||
} | ||
onunload() { | ||
} | ||
async loadSettings() { | ||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); | ||
} | ||
async saveSettings() { | ||
await this.saveData(this.settings); | ||
} | ||
}; | ||
var SampleModal = class extends import_obsidian.Modal { | ||
constructor(app) { | ||
super(app); | ||
} | ||
onOpen() { | ||
const { contentEl } = this; | ||
contentEl.setText("Woah!"); | ||
} | ||
onClose() { | ||
const { contentEl } = this; | ||
contentEl.empty(); | ||
} | ||
}; | ||
var SampleSettingTab = class extends import_obsidian.PluginSettingTab { | ||
constructor(app, plugin) { | ||
super(app, plugin); | ||
this.plugin = plugin; | ||
} | ||
display() { | ||
const { containerEl } = this; | ||
containerEl.empty(); | ||
new import_obsidian.Setting(containerEl).setName("Setting #1").setDesc("It's a secret").addText((text) => text.setPlaceholder("Enter your secret").setValue(this.plugin.settings.mySetting).onChange(async (value) => { | ||
this.plugin.settings.mySetting = value; | ||
await this.plugin.saveSettings(); | ||
})); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"id": "arabic-search", | ||
"name": "Arabic Search", | ||
"version": "1.0.0", | ||
"minAppVersion": "0.15.0", | ||
"description": "Provides miscellaneous search support for Arabic in Obsidian.", | ||
"author": "OdyAsh", | ||
"authorUrl": "https://github.com/OdyAsh", | ||
"fundingUrl": "https://obsidian.md/pricing", | ||
"isDesktopOnly": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
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. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.