Time display

mklink
This commit is contained in:
Mike Phares 2024-01-28 22:30:57 -07:00
parent 111a504f84
commit a4bd327ca3
6 changed files with 56 additions and 53 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ random
Images-dd514b88-Results Images-dd514b88-Results
node_modules node_modules
.kanbn .kanbn
.random
.original

14
.vscode/mklink.md vendored Normal file
View File

@ -0,0 +1,14 @@
---
type: "note"
---
# mklink
```bash
```
```bash
mklink /J "L:\Git\www\.kanbn" "D:\5-Other-Small\Kanban\www"
mklink /J "L:\Git\www\.random" "D:\1-Images-A\Images-7007a9df-Results\F)Random\7007a9df\[]"
mklink /J "L:\Git\www\.original" "D:\1-Images-A\Images-7007a9df-Results\C)Resize\7007a9df\Original\()"
```

View File

@ -11,8 +11,9 @@
<body> <body>
<div id="deviceReady"> <div id="deviceReady">
<p><a href='slideshow/index.html?b=2023-08-13-18-53'>Slideshow</a></p> <p><a href='slideshow/index.html?b=2024-01-28-20-23'>Slideshow</a></p>
<p><a href='slideshow/index.html?a=noSleep&b=2023-08-13-18-53'>Slideshow (No Sleep)</a></p> <p><a href='slideshow/index.html?a=time&b=2024-01-28-20-23'>Slideshow (Time)</a></p>
<p><a href='slideshow/index.html?a=noSleep&b=2024-01-28-20-23'>Slideshow (No Sleep)</a></p>
</div> </div>
</body> </body>

View File

@ -21,7 +21,7 @@
<script src="scripts/jquery-1.9.1.min.js"></script> <script src="scripts/jquery-1.9.1.min.js"></script>
<script src="scripts/bootstrap.min.js"></script> <script src="scripts/bootstrap.min.js"></script>
<script src="scripts/jquery.bgswitcher.js"></script> <script src="scripts/jquery.bgswitcher.js"></script>
<script type="text/javascript" src="scripts/index.js?nocache=2023_03_06_10_47_AM"></script> <script type="text/javascript" src="scripts/index.js?nocache=2024-01-28-20-23"></script>
</body> </body>
</html> </html>

View File

@ -2,6 +2,8 @@
"ImageInterval": 9123, "ImageInterval": 9123,
"JsonInterval": 59000, "JsonInterval": 59000,
"ImageZero": "images/1x1_00000000.png", "ImageZero": "images/1x1_00000000.png",
"DataDirectory": "../Images-dd514b88-Results/F)Random/dd514b88/[]", "DataDirectoryX": "../.random",
"Root": "../Images-dd514b88-Results/C)Resize/dd514b88/1376 x 768/()/_ _ _" "DataDirectory": "../Images-7007a9df-Results/F)Random/7007a9df/[]",
"RootX": "../.original",
"Root": "../Images-7007a9df-Results/C)Resize/7007a9df/Original/()"
} }

View File

@ -8,7 +8,6 @@
var _Root; var _Root;
var _RootAlt; var _RootAlt;
var _ImageZero; var _ImageZero;
var _JsonTimer;
var _ImageTimer; var _ImageTimer;
var _DataDirectory; var _DataDirectory;
@ -20,17 +19,23 @@
var _OpaqueIndex = 0; var _OpaqueIndex = 0;
var _DeviceReadyDiv = $("#deviceReady div"); var _DeviceReadyDiv = $("#deviceReady div");
var time = document.createElement('time');
time.setAttribute('style', 'position: fixed;');
// Create the root video element
var video = document.createElement('video');
video.setAttribute('loop', '');
// Add some styles if needed
video.setAttribute('style', 'position: fixed;');
$(document).ready(function () { $(document).ready(function () {
console.log("onDeviceReady"); console.log("onDeviceReady");
// Handle the Cordova pause and resume events // Handle the Cordova pause and resume events
document.addEventListener('pause', onPause.bind(this), false);
document.addEventListener('resume', onResume.bind(this), false);
document.addEventListener('keyup', getInput, false); document.addEventListener('keyup', getInput, false);
var url = '../slideshow/index.json'; var url = '../slideshow/index.json?nocache=2024-01-28-20-23';
console.log(url); console.log(url);
var _ = $.getJSON(url, function (data) { var _ = $.getJSON(url, function (data) {
console.log(url + " downloaded successfully"); console.log(url + " downloaded successfully");
@ -44,32 +49,12 @@
}) })
.done(function () { .done(function () {
loadData(); loadData();
_ = setInterval(onTickJSON, _JsonInterval);
_JsonTimer = setInterval(onTickJSON, _JsonInterval);
_ImageTimer = setInterval(onTickImage, _ImageInterval); _ImageTimer = setInterval(onTickImage, _ImageInterval);
}) })
.fail(function (er) { .fail(function (er) { console.log("error", er); })
console.log("error", er); .always(function () { console.log("complete"); });
_ImageInterval = 5000;
_JsonInterval = 59000;
_Root = "../pictures";
_DataDirectory = "../random";
// _ImageZero = "images/img_tree.gif";
// _ImageZero = "images/output-onlinepngtools.png";
_ImageZero = "images/1x1_00000000.png"; // https://shoonia.github.io/1x1/#00000000
})
.always(function () {
console.log("complete");
}); });
});
function onPause() {
// TODO: This application has been suspended. Save application state here.
}
function onResume() {
// TODO: This application has been reactivated. Restore application state here.
}
function goBack() { function goBack() {
_Pause = 1; _Pause = 1;
@ -172,25 +157,21 @@
var currentDate = new Date(); var currentDate = new Date();
var mm = (new Date().getMonth() + 1).toString().padStart(2, '0'); var mm = (new Date().getMonth() + 1).toString().padStart(2, '0');
var dd = currentDate.getDate().toString().padStart(2, '0'); var dd = currentDate.getDate().toString().padStart(2, '0');
var url = _DataDirectory + '/' + mm + '-' + dd + '.json'; if (window.location.href.indexOf('time') > 0) {
time.innerText = mm + '-' + dd + '.json';
}
var url = _DataDirectory + '/' + mm + '-' + dd + '.json?nocache=2024-01-28-20-23';
console.log(url); console.log(url);
var _ = $.getJSON(url, function (data) { $.getJSON(url, function (data) {
console.log("success", data.length); console.log("success", data.length);
_Images = []; _Images = [];
$.each(data, function (index, value) { $.each(data, function (_, value) {
_Images.push(value.replaceAll("\\", "/")); _Images.push(value.replaceAll("\\", "/"));
}); });
}) })
.done(function () { .done(function () { console.log("second success"); })
console.log("second success"); .fail(function (er) { console.log("error", er); })
}) .always(function () { console.log("complete"); });
.fail(function (er) {
console.log("error", er);
_Images = [_ImageZero];
})
.always(function () {
console.log("complete");
});
} }
function onTickJSON() { function onTickJSON() {
@ -245,15 +226,14 @@
var backgroundImage = GetBackgroundImage(); var backgroundImage = GetBackgroundImage();
_DeviceReadyDiv.eq(loadIndex).attr('style', backgroundImage); _DeviceReadyDiv.eq(loadIndex).attr('style', backgroundImage);
_DeviceReadyDiv.eq(_OpaqueIndex).addClass("opaque"); _DeviceReadyDiv.eq(_OpaqueIndex).addClass("opaque");
if (window.location.href.indexOf('time') > 0) {
var mm = (new Date().getMonth() + 1).toString().padStart(2, '0');
var dd = currentDate.getDate().toString().padStart(2, '0');
time.innerText = mm + '-' + dd + '.json' + ' ' + _Images[_ImageIndex];
}
} }
} }
} }
// Create the root video element
var video = document.createElement('video');
video.setAttribute('loop', '');
// Add some styles if needed
video.setAttribute('style', 'position: fixed;');
// A helper to add sources to video // A helper to add sources to video
function addSourceToVideo(element, type, dataURI) { function addSourceToVideo(element, type, dataURI) {
@ -285,4 +265,8 @@
document.body.addEventListener('touchend', playFn); document.body.addEventListener('touchend', playFn);
} }
if (window.location.href.indexOf('time') > 0) {
document.body.appendChild(time);
}
})(); })();