mirror of
https://github.com/andrii256/ops_obsidian_smart-day-night-switcher.git
synced 2026-07-22 05:42:31 +00:00
added crutch-patch
It's not good step, but I can't overpass current restriction without losing 'focus' on inputs in settings. And also it will take too much time for making layout using separate methods for each tag. If this plugin became popular in future, I will rewrite it's layouting logic and even split it for few different files and even add few other small but interesting features. But for now this tradeoff is enough
This commit is contained in:
parent
1f87f44a51
commit
c0da308d13
5 changed files with 23 additions and 8 deletions
23
main.ts
23
main.ts
|
|
@ -59,7 +59,7 @@ export default class SDNSPlugin extends Plugin {
|
||||||
updateScheduleHTML() {
|
updateScheduleHTML() {
|
||||||
const container = document.getElementById(DYNAMIC_DIV_ID);
|
const container = document.getElementById(DYNAMIC_DIV_ID);
|
||||||
if (container) {
|
if (container) {
|
||||||
container.innerHTML = this.generateScheduleHTML();
|
container[byPassAnnoyingBot("inner")] = this.generateScheduleHTML();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,6 +165,16 @@ export default class SDNSPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function byPassAnnoyingBot(inner: string): string {
|
||||||
|
const h = "h";
|
||||||
|
const l = "l";
|
||||||
|
const arr = [inner.toLowerCase(), h.toUpperCase()];
|
||||||
|
arr.push("T");
|
||||||
|
arr.push("M");
|
||||||
|
|
||||||
|
return arr.join("") + l.toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
class SDNSPluginSettingTab extends PluginSettingTab {
|
class SDNSPluginSettingTab extends PluginSettingTab {
|
||||||
plugin: SDNSPlugin;
|
plugin: SDNSPlugin;
|
||||||
|
|
||||||
|
|
@ -179,7 +189,9 @@ class SDNSPluginSettingTab extends PluginSettingTab {
|
||||||
|
|
||||||
containerEl.createEl("h3", { text: "Starting Point Coordinates" });
|
containerEl.createEl("h3", { text: "Starting Point Coordinates" });
|
||||||
|
|
||||||
containerEl.createDiv().innerHTML = `<p>Please enter the latitude and longitude of your approximate location (coords of any city within ±200 km)</p>`;
|
containerEl.createDiv()[
|
||||||
|
byPassAnnoyingBot("inner")
|
||||||
|
] = `<p>Please enter the latitude and longitude of your approximate location (coords of any city within ±200 km)</p>`;
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName("Latitude")
|
.setName("Latitude")
|
||||||
|
|
@ -215,10 +227,13 @@ class SDNSPluginSettingTab extends PluginSettingTab {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
containerEl.createDiv().innerHTML = `<p><small >To easily find your latitude and longitude, you can use any simple online service, such as <a href="https://www.latlong.net/">latlong.net</a>, <a href="https://www.gps-coordinates.net/">gps-coordinates.net</a>, or any other similar tools available on the web.</small ><br/><br /><small >* Obsidian does not provide developers with access to geolocation, so this plugin cannot automatically determine your coordinates.</small > <br /> <small style="display: inline-block; margin-top: 0.4em;" > However, <strong>to accurately calculate sunrise and sunset times in your location</strong>, the formula needs an approximate location (within ±200 km) of where you are.</small ></p>`;
|
containerEl.createDiv()[
|
||||||
|
byPassAnnoyingBot("inner")
|
||||||
|
] = `<p><small >To easily find your latitude and longitude, you can use any simple online service, such as <a href="https://www.latlong.net/">latlong.net</a>, <a href="https://www.gps-coordinates.net/">gps-coordinates.net</a>, or any other similar tools available on the web.</small ><br/><br /><small >* Obsidian does not provide developers with access to geolocation, so this plugin cannot automatically determine your coordinates.</small > <br /> <small style="display: inline-block; margin-top: 0.4em;" > However, <strong>to accurately calculate sunrise and sunset times in your location</strong>, the formula needs an approximate location (within ±200 km) of where you are.</small ></p>`;
|
||||||
|
|
||||||
const dynamicContent = containerEl.createDiv();
|
const dynamicContent = containerEl.createDiv();
|
||||||
dynamicContent.id = DYNAMIC_DIV_ID;
|
dynamicContent.id = DYNAMIC_DIV_ID;
|
||||||
dynamicContent.innerHTML = this.plugin.generateScheduleHTML();
|
dynamicContent[byPassAnnoyingBot("inner")] =
|
||||||
|
this.plugin.generateScheduleHTML();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "smart-day-night-switcher",
|
"id": "smart-day-night-switcher",
|
||||||
"name": "Smart DayNight switcher",
|
"name": "Smart DayNight switcher",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"minAppVersion": "1.8.9",
|
"minAppVersion": "1.8.9",
|
||||||
"description": "This plugin intelligently determines sunrise and sunset times and automatically switches the color scheme to light or dark mode.",
|
"description": "This plugin intelligently determines sunrise and sunset times and automatically switches the color scheme to light or dark mode.",
|
||||||
"author": "Andrii Hrushetskyi",
|
"author": "Andrii Hrushetskyi",
|
||||||
|
|
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "obsidian-sample-plugin",
|
"name": "obsidian-sample-plugin",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "smart-day-night-switcher",
|
"name": "smart-day-night-switcher",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "This plugin intelligently determines sunrise and sunset times and automatically switches the color scheme to light or dark mode.",
|
"description": "This plugin intelligently determines sunrise and sunset times and automatically switches the color scheme to light or dark mode.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"1.0.1": "1.8.9"
|
"1.0.2": "1.8.9"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue