Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save redhog/618389 to your computer and use it in GitHub Desktop.

Select an option

Save redhog/618389 to your computer and use it in GitHub Desktop.
commit e65de1ad71d1f7a14a531c9ab6480208bc302f8d
Author: Ari Bader-Natal <[email protected]>
Date: Sun Apr 18 22:09:51 2010 -0700
visibility of author edit colors can now be toggled on timeslider.
diff --git a/etherpad/src/etherpad/control/pad/pad_control.js b/etherpad/src/etherpad/control/pad/pad_control.js
index 809407f..0a7bd45 100644
--- a/etherpad/src/etherpad/control/pad/pad_control.js
+++ b/etherpad/src/etherpad/control/pad/pad_control.js
@@ -363,6 +363,7 @@ function render_pad(localPadId) {
userColor: assignColorId(pad, userId),
specialKey: specialKey,
specialKeyTranslation: collab_server.translateSpecialKey(specialKey),
+ showAuthorEditColorsInBroadcast: false,
opts: opts
});
});
diff --git a/etherpad/src/static/css/broadcast.css b/etherpad/src/static/css/broadcast.css
index 7c61925..0a383a4 100644
--- a/etherpad/src/static/js/broadcast.js
+++ b/etherpad/src/static/js/broadcast.js
@@ -594,10 +594,15 @@ function receiveAuthorData(newAuthorData) {
var data = newAuthorData[author];
if ((typeof data.colorId) == 'number') {
var bgcolor = clientVars.colorPalette[data.colorId];
+ var showColors = clientVars.showAuthorEditColorsInBroadcast;
if (bgcolor && dynamicCSS) {
- dynamicCSS.selectorStyle(
- '.'+linestylefilter.getAuthorClassName(author)).backgroundColor =
- bgcolor;
+ if (showColors) {
+ dynamicCSS.selectorStyle(
+ '.'+linestylefilter.getAuthorClassName(author)).backgroundColor = bgcolor;
+ } else {
+ dynamicCSS.removeSelectorStyle(
+ '.'+linestylefilter.getAuthorClassName(author));
+ }
}
}
authorData[author] = data;
+function toggleEditColorVisibility() {
+ if (!clientVars.showAuthorEditColorsInBroadcast) {
+ clientVars.showAuthorEditColorsInBroadcast = true;
+ $("a#toggleEditColorLink").html("hide colors");
+ } else {
+ clientVars.showAuthorEditColorsInBroadcast = false;
+ $("a#toggleEditColorLink").html("show colors");
+ }
+ receiveAuthorData(clientVars.historicalAuthorData);
+}
+
diff --git a/etherpad/src/templates/pad/padview_body.ejs b/etherpad/src/templates/pad/padview_body.ejs
index 399a856..f13881c 100644
--- a/etherpad/src/templates/pad/padview_body.ejs
+++ b/etherpad/src/templates/pad/padview_body.ejs
@@ -139,7 +148,7 @@ limitations under the License. */ %><%
</div>
<div id="legend">
-<h2>Authors <a class="blue11" href="javascript:void toggleEditColorVisibility();"><s>hide colors</s></a></h2>
+<h2>Authors <a class="blue11" id="toggleEditColorLink" href="javascript:void toggleEditColorVisibility();">show colors</a></h2>
<table id="authorstable" border="0" cellspacing="0" cellpadding="0">
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment