diff --git a/src/lib/clip.js b/src/lib/clip.js index 8b067eb..1f2225c 100644 --- a/src/lib/clip.js +++ b/src/lib/clip.js @@ -17,6 +17,7 @@ export const create = async (testing=false) => { dateFormat: "YYYY-MM-DD", datetimeFormat: "YYYY-MM-DD HH:mm:ss", timeFormat: "HH:mm:ss", + zettelFormat: "YYYYMMDDmmss", } async function getFromStorage(key) { @@ -35,7 +36,7 @@ export const create = async (testing=false) => { let day = moment().format("DD") let month = moment().format("MM") let year = moment().format("YYYY") - let zettel = moment().format("YYYYMMDDHHmmss") + let zettel = moment().format(clippingOptions.zettelFormat) let selection = ''; let link = ''; diff --git a/src/options.html b/src/options.html index f0387b2..52b3575 100644 --- a/src/options.html +++ b/src/options.html @@ -69,6 +69,11 @@

An unoffical clipper

+ +
+ + +
@@ -82,4 +87,4 @@

An unoffical clipper

by jplattel

- \ No newline at end of file + diff --git a/src/options.js b/src/options.js index ea32875..ed7534a 100644 --- a/src/options.js +++ b/src/options.js @@ -9,6 +9,7 @@ function saveOptions() { var datetimeFormat = document.getElementById('datetime_format').value; var dateFormat = document.getElementById('date_format').value; var timeFormat = document.getElementById('time_format').value; + var zettelFormat = document.getElementById('zettel_format').value; chrome.storage.sync.set({ obsidianVaultName: obsidianVaultName, @@ -19,6 +20,8 @@ function saveOptions() { datetimeFormat: datetimeFormat, dateFormat: dateFormat, timeFormat: timeFormat, + zettelFormat: zettelFormat, + }, function() { // Update status to let user know options were saved. var status = document.getElementById('status'); @@ -43,6 +46,7 @@ Clipped from [{title}]({url}) at {date}.`, datetimeFormat: "YYYY-MM-DD HH:mm:ss", dateFormat: "YYYY-MM-DD", timeFormat: "HH:mm:ss", + zettelFormat: "YYYYMMDDHHmmss", }, function(options) { document.getElementById('obsidian_vault_name').value = options.obsidianVaultName; document.getElementById('obsidian_note_name').value = options.obsidianNoteName; @@ -52,6 +56,7 @@ Clipped from [{title}]({url}) at {date}.`, document.getElementById('datetime_format').value = options.datetimeFormat; document.getElementById('date_format').value = options.dateFormat; document.getElementById('time_format').value = options.timeFormat; + document.getElementById('zettel_format').value = options.zettelFormat; }); } @@ -72,4 +77,4 @@ async function testClipping() { document.addEventListener('DOMContentLoaded', restoreOptions); document.getElementById('save').addEventListener('click', saveOptions); document.getElementById('reset').addEventListener('click', resetFormat); -document.getElementById('test').addEventListener('click', testClipping); \ No newline at end of file +document.getElementById('test').addEventListener('click', testClipping);