Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10669229
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/static/js/localdate.js b/static/js/localdate.js
index 19fa502..879ebe4 100644
--- a/static/js/localdate.js
+++ b/static/js/localdate.js
@@ -1,9 +1,16 @@
-function toLocalDate(el) {
- var d = new Date(el.getAttribute("datetime"));
- el.textContent = d.toLocaleDateString(navigator.language || "en-US", { year: 'numeric', month: 'long', day: 'numeric' });
+function toLocalDate(dateEl, displayEl) {
+ var d = new Date(dateEl.getAttribute("datetime"));
+ displayEl.textContent = d.toLocaleDateString(navigator.language || "en-US", { year: 'numeric', month: 'long', day: 'numeric' });
}
-var $dates = document.querySelectorAll("time");
+// Adjust dates on individual post pages, and on posts in a list *with* an explicit title
+var $dates = document.querySelectorAll("article > time");
for (var i=0; i < $dates.length; i++) {
- toLocalDate($dates[i]);
+ toLocalDate($dates[i], $dates[i]);
}
+
+// Adjust dates on posts in a list without an explicit title, where they act as the header
+$dates = document.querySelectorAll("h2.post-title > time");
+for (i=0; i < $dates.length; i++) {
+ toLocalDate($dates[i], $dates[i].querySelector('a'));
+}
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, May 15, 8:06 PM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3238189
Attached To
rWF WriteFreely
Event Timeline
Log In to Comment