MarkTraceur has uploaded a new change for review.
https://gerrit.wikimedia.org/r/90040
Change subject: Add creation time to list
......................................................................
Add creation time to list
Fallback to upload time for now.
Change-Id: I822b48cebbace51cd8f68adc45a68a1c93ec29db
---
M MultimediaViewer.i18n.php
M MultimediaViewer.php
M css/ext.multimediaViewer.css
A img/time.svg
M js/ext.multimediaViewer.js
5 files changed, 52 insertions(+), 4 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer
refs/changes/40/90040/1
diff --git a/MultimediaViewer.i18n.php b/MultimediaViewer.i18n.php
index e5defdb..e103ef9 100644
--- a/MultimediaViewer.i18n.php
+++ b/MultimediaViewer.i18n.php
@@ -31,6 +31,8 @@
'multimediaviewer-pref-desc' => 'Enables a nicer-looking multimedia
viewer for images on pages that have thumbnails. Uses a third party lightbox
library and JavaScript.',
'multimediaviewer-file-page' => 'Go to corresponding file page',
'multimediaviewer-userpage-link' => '{{GENDER|$1|Uploaded}} by $1',
+ 'multimediaviewer-datetime-created' => 'Created on $1',
+ 'multimediaviewer-datetime-uploaded' => 'Uploaded on $1',
);
/** Message documentation (Message documentation)
@@ -42,6 +44,8 @@
'multimediaviewer-pref-desc' => 'Description of preference',
'multimediaviewer-file-page' => 'Text for a link to the file page for
an image.',
'multimediaviewer-userpage-link' => 'Link to the user page for the
uploader of the image. $1 is the username of the uploader.',
+ 'multimedia-datetime-created' => 'Date and time the image or work was
created. $1 is always a date string, no need to translate.',
+ 'multimedia-datetime-uploaded' => 'Date and time the image was uploaded
- fallback in case there is no data for creation date. $1 is always a date
string, no need to translate.',
);
/** German (Deutsch)
diff --git a/MultimediaViewer.php b/MultimediaViewer.php
index 5554191..7208f54 100644
--- a/MultimediaViewer.php
+++ b/MultimediaViewer.php
@@ -72,6 +72,8 @@
'messages' => array(
'multimediaviewer-file-page',
'multimediaviewer-userpage-link',
+ 'multimediaviewer-datetime-created',
+ 'multimediaviewer-datetime-uploaded',
),
), $moduleInfo );
diff --git a/css/ext.multimediaViewer.css b/css/ext.multimediaViewer.css
index 4d65aa5..ed1079b 100644
--- a/css/ext.multimediaViewer.css
+++ b/css/ext.multimediaViewer.css
@@ -114,16 +114,28 @@
list-style: none;
}
-.mw-mlb-image-links li.mw-mlb-username-li:before {
- background-image: url( '../img/user.svg' );
+.mw-mlb-image-links li:before {
display: inline-block;
vertical-align: middle;
height: 16px;
width: 16px;
content: ' ';
margin-right: 10px;
+ background-size: contain;
+}
+
+.mw-mlb-image-links li.mw-mlb-username-li:before {
+ background-image: url( '../img/user.svg' );
}
.mw-mlb-image-links li.mw-mlb-username-li.empty:before {
background-image: none;
}
+
+.mw-mlb-image-links li.mw-mlb-datetime-li:before {
+ background-image: url( '../img/time.svg' );
+}
+
+.mw-mlb-image-links li.mw-mlb-datetime-li.empty:before {
+ background-image: none;
+}
diff --git a/img/time.svg b/img/time.svg
new file mode 100644
index 0000000..149cfb8
--- /dev/null
+++ b/img/time.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC
"-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg version="1.1"
id="Layer_1" xmlns="http://www.w3.org/2000/svg" width="32px"
height="32px"><circle fill="#939598" cx="16" cy="16" r="15" /><path d="M 16,3.5
L 16,16 L 23,23" stroke="white" stroke-width="3px" fill="none" /></svg>
diff --git a/js/ext.multimediaViewer.js b/js/ext.multimediaViewer.js
index 95dbdd7..da46775 100644
--- a/js/ext.multimediaViewer.js
+++ b/js/ext.multimediaViewer.js
@@ -63,7 +63,7 @@
viewer.lightbox.open();
viewer.fetchImageInfo( fileTitle, function (
imageInfo ) {
- var username;
+ var username, extmeta, datetime, dtmsg;
viewer.lightbox.images[index].src =
imageInfo.imageinfo[0].url;
viewer.lightbox.open();
@@ -81,6 +81,26 @@
}
viewer.lightbox.iface.$usernameLi.toggleClass( 'empty', username );
+
+ extmeta =
imageInfo.imageinfo[0].extendedmetadata;
+
+ if ( extmeta ) {
+ datetime =
extmeta.DateTimeOriginal || extmeta.DateTime;
+
+ if ( datetime ) {
+ dtmsg = (
+
'multimediaviewer-datetime-' +
+ (
extmeta.DateTimeOriginal ? 'created' : 'uploaded' )
+ );
+ datetime =
datetime.value;
+
+
viewer.lightbox.iface.$datetime.text(
+ mw.message(
dtmsg, datetime ).text()
+ );
+ }
+
+
viewer.lightbox.iface.$datetimeLi.toggleClass( 'empty', datetime );
+ }
} );
return false;
@@ -115,10 +135,19 @@
.addClass( 'empty' )
.html( this.$username );
+ this.$datetime = $( '<span>' )
+ .addClass( 'mw-mlb-datetime' );
+
+ this.$datetimeLi = $( '<li>' )
+ .addClass( 'mw-mlb-datetime-li' )
+ .addClass( 'empty' )
+ .html( this.$datetime );
+
this.$imageLinks = $( '<ul>' )
.addClass( 'mw-mlb-image-links' )
.append(
- this.$usernameLi
+ this.$usernameLi,
+ this.$datetimeLi
);
this.$imageLinkDiv = $( '<div>' )
.addClass( 'mw-mlb-image-links-div' )
--
To view, visit https://gerrit.wikimedia.org/r/90040
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I822b48cebbace51cd8f68adc45a68a1c93ec29db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits