ep_author_hover
Advanced tools
Comparing version 0.0.5 to 0.0.7
@@ -6,3 +6,4 @@ { | ||
"hooks" : { | ||
}, | ||
"eejsBlock_mySettings": "ep_author_hover/index" | ||
}, | ||
"client_hooks" : { | ||
@@ -9,0 +10,0 @@ "postAceInit":"ep_author_hover/static/js/index" |
@@ -9,3 +9,3 @@ { | ||
"description": "Adds author names to span titles (shows on hover), works as authors change their name. Hover includes author color and fast switching between author spans. Hat tip to Martyn York for the initial work on this.", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"repository": { | ||
@@ -12,0 +12,0 @@ "type": "git", |
var _ = require('ep_etherpad-lite/static/js/underscore'); | ||
var padcookie = require('ep_etherpad-lite/static/js/pad_cookie').padcookie; | ||
@@ -7,2 +8,29 @@ var timer = 0; | ||
showAuthor.enable(context); | ||
/* init */ | ||
if (padcookie.getPref("author-hover") === false) { | ||
$('#options-author-hover').val() | ||
$('#options-author-hover').attr('checked','unchecked'); | ||
$('#options-author-hover').attr('checked',false); | ||
}else{ | ||
$('#options-author-hover').attr('checked','checked'); | ||
} | ||
if($('#options-author-hover').is(':checked')) { | ||
clientVars.plugins.plugins.ep_author_hover.enabled = true; | ||
} else { | ||
clientVars.plugins.plugins.ep_author_hover.enabled = false; | ||
} | ||
/* on click */ | ||
$('#options-author-hover').on('click', function() { | ||
if($('#options-author-hover').is(':checked')) { | ||
padcookie.setPref("author-hover", true) | ||
clientVars.plugins.plugins.ep_author_hover = true; | ||
} else { | ||
padcookie.setPref("author-hover", false) | ||
clientVars.plugins.plugins.ep_author_hover = true; | ||
} | ||
}); | ||
} | ||
@@ -18,3 +46,3 @@ | ||
disable: function(context){ | ||
context.ace.callWithAce(function(ace){ | ||
context.ace.callWithAce(function(ace){ | ||
var doc = ace.ace_getDocument(); | ||
@@ -36,7 +64,9 @@ $(doc).find('#innerdocbody').mousemove(_().bind(ace)); | ||
show: function(span){ | ||
var authorId = showAuthor.authorIdFromClass(span.target.className); // Get the authorId | ||
if(!authorId){ return; } // Default text isn't shown | ||
showAuthor.destroy(); // Destroy existing | ||
var authorNameAndColor = showAuthor.authorNameAndColorFromAuthorId(authorId); // Get the authorName And Color | ||
showAuthor.draw(span, authorNameAndColor.name, authorNameAndColor.color); | ||
if(clientVars.plugins.plugins.ep_author_hover.enabled){ | ||
var authorId = showAuthor.authorIdFromClass(span.target.className); // Get the authorId | ||
if(!authorId){ return; } // Default text isn't shown | ||
showAuthor.destroy(); // Destroy existing | ||
var authorNameAndColor = showAuthor.authorNameAndColorFromAuthorId(authorId); // Get the authorName And Color | ||
showAuthor.draw(span, authorNameAndColor.name, authorNameAndColor.color); | ||
} | ||
}, | ||
@@ -58,4 +88,6 @@ authorIdFromClass: function(className){ | ||
authorNameAndColorFromAuthorId: function(authorId){ | ||
// todo figure out why we need a substring to fix this | ||
authorId = authorId.substring(0,14); // don't ask.... something appears to be fucked in regex | ||
// It could always be me.. | ||
var myAuthorId = pad.myUserInfo.userId; | ||
var myAuthorId = pad.myUserInfo.userId.substring(0,14); | ||
if(myAuthorId == authorId){ | ||
@@ -71,3 +103,3 @@ return { | ||
$('#otheruserstable > tbody > tr').each(function(){ | ||
if (authorId == $(this).data("authorid")){ | ||
if (authorId == $(this).data("authorid").substring(0,14)){ | ||
$(this).find('.usertdname').each( function() { | ||
@@ -74,0 +106,0 @@ authorObj.name = $(this).text(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7296
8
152