Mouse Clock 1.1.0: online settings editor with copy/download, window.MouseClockOptions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cfe6c1c3df
commit
3f9ac3e1de
3 files changed
+499
-19
No files matched your search
+7
-3
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* 滑鼠立體時鐘 Mouse Clock 1.0.0
|
||||
* 滑鼠立體時鐘 Mouse Clock 1.1.0
|
||||
* https://code.tsdylab.com/tangsongdayo/mouse-clock
|
||||
*
|
||||
* 原作:Silly Clock 3 by Kurt Grigg
|
||||
@@ -177,11 +177,15 @@
|
||||
}
|
||||
|
||||
var current = document.currentScript;
|
||||
window.MouseClock = { start: start, stop: function () { if (running) running.stop(); }, defaults: DEFAULTS };
|
||||
// 1.1.0:在載入前設定 window.MouseClockOptions = {...} 也可以調整(data-* 屬性優先)
|
||||
var preset = window.MouseClockOptions;
|
||||
window.MouseClock = { version: '1.1.0', start: start, stop: function () { if (running) running.stop(); }, defaults: DEFAULTS };
|
||||
|
||||
// 加上 data-manual 就不自動啟動,改由 MouseClock.start({...}) 啟動
|
||||
if (!(current && current.dataset && current.dataset.manual !== undefined)) {
|
||||
var opts = fromScriptTag(current);
|
||||
var opts = {}, tagOpts = fromScriptTag(current), key;
|
||||
if (preset && typeof preset === 'object') for (key in preset) opts[key] = preset[key];
|
||||
for (key in tagOpts) opts[key] = tagOpts[key];
|
||||
if (document.body) start(opts);
|
||||
else document.addEventListener('DOMContentLoaded', function () { start(opts); });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user