diff --git a/extensions/wikidata/module/langs/translation-en.json b/extensions/wikidata/module/langs/translation-en.json
index 17f2ace1a..2b5700d2d 100644
--- a/extensions/wikidata/module/langs/translation-en.json
+++ b/extensions/wikidata/module/langs/translation-en.json
@@ -106,6 +106,7 @@
"wikibase-account/logged-in-as": "You are logged in as:",
"wikibase-account/log-out": "Log out",
"wikibase-account/connecting-to-wikibase": "Connecting to Wikibase…",
+ "wikibase-account/logo-alt-text": "$1 Logo",
"perform-wikibase-edits/dialog-header": "Upload edits to $1",
"perform-wikibase-edits/review-your-edits": "You are about to upload $1 edits to $3. Please check them carefully. Large edit batches should be submitted for bot review first.",
"perform-wikibase-edits/logged-in-as": "You are logged in as",
diff --git a/extensions/wikidata/module/langs/translation-en_GB.json b/extensions/wikidata/module/langs/translation-en_GB.json
index 692a893fc..6f5062329 100644
--- a/extensions/wikidata/module/langs/translation-en_GB.json
+++ b/extensions/wikidata/module/langs/translation-en_GB.json
@@ -120,6 +120,7 @@
"wikibase-account/log-in": "Log in",
"wikibase-account/logged-in-as": "You are logged in as:",
"wikibase-account/log-out": "Log out",
+ "wikibase-account/logo-alt-text": "$1 Logo",
"wikibase-preview/new-id": "new item",
"wikibase-schema/unsaved-warning": "You have made unsaved changes to your Wikidata schema. Close anyway?",
"wikibase-schema/incomplete-schema-could-not-be-saved": "Your schema is incomplete so it cannot be saved yet.",
diff --git a/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.js b/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.js
index 333dd2561..6132002c0 100644
--- a/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.js
+++ b/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.js
@@ -79,6 +79,11 @@ ManageAccountDialog.displayPasswordLogin = function (onSuccess) {
const frame = $(DOM.loadHTML("wikidata", "scripts/dialogs/password-login-dialog.html"));
const elmts = DOM.bind(frame);
ManageAccountDialog.initCommon(elmts);
+ WikibaseManager.getSelectedWikibaseLogoURL(function(data) {
+ elmts.wikibaseLogoImg.attr("src", data);
+ });
+ elmts.wikibaseMainPage.attr("href", WikibaseManager.getSelectedWikibaseMainPage());
+ elmts.wikibaseLogoImg.attr("alt", $.i18n('wikibase-account/logo-alt-text', WikibaseManager.getSelectedWikibaseName()));
elmts.explainBotPasswords.html($.i18n('wikibase-account/explain-bot-passwords', WikibaseManager.getSelectedWikibaseRoot() + 'Special:BotPasswords'));
elmts.explainOwnerOnlyConsumerLogin.html($.i18n('wikibase-account/explain-owner-only-consumer-login'));
elmts.invalidCredentials.text($.i18n('wikibase-account/invalid-credentials'));
diff --git a/extensions/wikidata/module/scripts/dialogs/password-login-dialog.html b/extensions/wikidata/module/scripts/dialogs/password-login-dialog.html
index 4f19ae433..76503f567 100644
--- a/extensions/wikidata/module/scripts/dialogs/password-login-dialog.html
+++ b/extensions/wikidata/module/scripts/dialogs/password-login-dialog.html
@@ -2,8 +2,8 @@
diff --git a/extensions/wikidata/module/scripts/dialogs/wikibase-dialog.js b/extensions/wikidata/module/scripts/dialogs/wikibase-dialog.js
index 01ba82076..75dd4ba6d 100644
--- a/extensions/wikidata/module/scripts/dialogs/wikibase-dialog.js
+++ b/extensions/wikidata/module/scripts/dialogs/wikibase-dialog.js
@@ -28,17 +28,20 @@ WikibaseDialog.populateDialog = function () {
WikibaseDialog.elmts.wikibaseList.empty();
for (let wikibaseName in wikibases) {
- if (wikibases.hasOwnProperty(wikibaseName)) {
- let item = "
";
- item += "" + wikibaseName + " | ";
- if (wikibaseName.toLowerCase() === WikibaseManager.getSelectedWikibaseName().toLowerCase()) {
- item += " | ";
- } else {
- item += " | ";
+ WikibaseManager.getSelectedWikibaseLogoURL(function(data) {
+ if (wikibases.hasOwnProperty(wikibaseName)) {
+ let item = "
";
+ item += "" + "" + " | ";
+ item += "" + wikibaseName + " | ";
+ if (wikibaseName.toLowerCase() === WikibaseManager.getSelectedWikibaseName().toLowerCase()) {
+ item += " | ";
+ } else {
+ item += " | ";
+ }
+ item += "
";
+ WikibaseDialog.elmts.wikibaseList.append(item);
}
- item += "";
- WikibaseDialog.elmts.wikibaseList.append(item);
- }
+ }, wikibaseName);
}
};
diff --git a/extensions/wikidata/module/scripts/wikibase-manager.js b/extensions/wikidata/module/scripts/wikibase-manager.js
index 3a7089c2e..b6c0d1234 100644
--- a/extensions/wikidata/module/scripts/wikibase-manager.js
+++ b/extensions/wikidata/module/scripts/wikibase-manager.js
@@ -188,3 +188,60 @@ WikibaseManager.fetchManifestFromURL = function (manifestURL, onSuccess, onError
});
};
+var wikibaseLogoURLCache = {
+ data: {},
+ exist: function (url) {
+ return wikibaseLogoURLCache.data.hasOwnProperty(url);
+ },
+ get: function (url) {
+ return wikibaseLogoURLCache.data[url];
+ },
+ set: function (url, cachedData) {
+ wikibaseLogoURLCache.data[url] = cachedData.responseJSON.query.general.logo;
+ }
+};
+
+
+// Retrives the wikibaseName instance site info, if wikibaseName is empty returns the selected wikibase site info
+WikibaseManager.retrieveLogoUrlFromSiteInfo = function(onSuccess, onError, wikibaseName) {
+ var params = {
+ action: 'query',
+ meta: 'siteinfo',
+ format: 'json'
+ };
+ let wikibase = (wikibaseName) ? WikibaseManager.wikibases[wikibaseName] : WikibaseManager.getSelectedWikibase();
+ const url = wikibase.mediawiki.api;
+ return $.ajax({
+ url: url,
+ data: params,
+ dataType: "jsonp",
+ timeout: 1000,
+ cache: true,
+ beforeSend: function () {
+ if (wikibaseLogoURLCache.exist(url)) {
+ onSuccess(wikibaseLogoURLCache.get(url));
+ return false;
+ }
+ return true;
+ },
+ complete: function (jqXHR, textStatus) {
+ wikibaseLogoURLCache.set(url, jqXHR);
+ },
+ success: function(response) {
+ onSuccess(response.query.general.logo);
+ },
+ error: function(xhr, status, error) {
+ onError(xhr, status, error);
+ },
+ });
+};
+
+// Retrives the logo url of wikibaseName, if wikibaseName is empty returns the selected wikibase logo url
+WikibaseManager.getSelectedWikibaseLogoURL = function(onDone, wikibaseName) {
+ WikibaseManager.retrieveLogoUrlFromSiteInfo(function(data) {
+ onDone(data);
+ }, function(xhr, status, error) {
+ onDone("extension/wikidata/images/Wikibase_logo.png");
+ }, wikibaseName);
+};
+
diff --git a/extensions/wikidata/module/styles/dialogs/wikibase-dialog.less b/extensions/wikidata/module/styles/dialogs/wikibase-dialog.less
index 00e9259c1..6495aa5a0 100644
--- a/extensions/wikidata/module/styles/dialogs/wikibase-dialog.less
+++ b/extensions/wikidata/module/styles/dialogs/wikibase-dialog.less
@@ -42,3 +42,12 @@
.wikibase-dialog-selector-remove.wikibase-selected:hover {
cursor: not-allowed;
}
+
+.wikibase-dialog-wikibase-logo {
+ width: 12%;
+}
+
+.wikibase-dialog-wikibase-logo img{
+ max-height: 60px;
+ max-width: 60px;
+}
\ No newline at end of file