Skip to content

Commit 4238884

Browse files
committed
Merge branch 'toolbar'
2 parents 9c2f528 + f825808 commit 4238884

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{info}}This document is used internally by the Realtime WikiText Editor{{/info}}
1+
{{info}}This document is used internally by the Realtime Editors{{/info}}

src/xwiki/RTFrontend/WebHome/attachments/toolbar.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ define([
5151
'}',
5252
'.rt-user-link {',
5353
' cursor: pointer;',
54+
' color: #0088CC;',
55+
'}',
56+
'.rt-user-link:hover {',
5457
' text-decoration: underline;',
55-
' color: #220FDD;',
58+
' color: #005580;',
5659
'}',
5760
'.rt-user-avatar {',
5861
' vertical-align: top;',
@@ -141,15 +144,17 @@ define([
141144
comma = "";
142145
}
143146
} catch (e) { console.error(e); }
144-
list += '<span class="rt-user-link" data-id="' + user + '">' + display + '</span>' + comma + ' ';
147+
var linkClass = "";
148+
if (config.marginAvatar == "1") { linkClass = "rt-user-link"; }
149+
list += '<span class="' + linkClass + '" data-id="' + user + '">' + display + '</span>' + comma + ' ';
145150
i++;
146151
}
147152
}
148153
});
149154
return (i > 0) ? list.slice(0, -2) : list;
150155
};
151156

152-
var updateUserList = function (myUserName, listElement, userList, userData) {
157+
var updateUserList = function (myUserName, listElement, userList, userData, onUsernameClick) {
153158
var meIdx = userList.indexOf(myUserName);
154159
if (meIdx === -1) {
155160
listElement.textContent = Messages.synchronizing;
@@ -164,8 +169,11 @@ define([
164169
}
165170
$('.rt-user-link').off('click');
166171
$('.rt-user-link').on('click' , function() {
167-
var basehref = $('iframe')[0].contentWindow.location.href.split('#')[0] || "";
168-
$('iframe')[0].contentWindow.location.href = basehref + "#rt-user-" + $(this).attr('data-id');
172+
if (typeof onUsernameClick !== "undefined") { onUsernameClick($(this.attr('data-id'))); }
173+
else if ($('iframe').length) {
174+
var basehref = $('iframe')[0].contentWindow.location.href.split('#')[0] || "";
175+
$('iframe')[0].contentWindow.location.href = basehref + "#rt-user-" + $(this).attr('data-id');
176+
}
169177
});
170178
};
171179

@@ -200,6 +208,7 @@ define([
200208
var lagElement = createLagElement(toolbar.find('.rt-toolbar-rightside'));
201209
var userData = config.userData;
202210
var changeNameID = config.changeNameID;
211+
var onUsernameClick = config.onUsernameClick || undefined;
203212

204213
// Check if the user is allowed to change his name
205214
if(changeNameID) {
@@ -216,7 +225,7 @@ define([
216225
if(newUserData) { // Someone has changed his name/color
217226
userData = newUserData;
218227
}
219-
updateUserList(myUserName, userListElement, users, userData);
228+
updateUserList(myUserName, userListElement, users, userData, onUsernameClick);
220229
});
221230

222231
var ks = function () {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{info}}This document contains the internal code which makes the realtime wiki work.{{/info}}
1+
{{info}}This document contains the internal code which makes the realtime editors work.{{/info}}

0 commit comments

Comments
 (0)