ep_cursortrace
Advanced tools
Comparing version 3.0.2 to 3.0.3
{ | ||
"name": "ep_cursortrace", | ||
"description": "Show cursor/caret movements of other users in real time", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"author": "RedHog (Egil Moeller) <egil.moller@freecode.no>", | ||
@@ -6,0 +6,0 @@ "repository":"git@github.com:redhog/ep_cursortrace.git", |
@@ -117,8 +117,7 @@ var initiated = false; | ||
var innerWidth = inner.contents().find('#innerdocbody').width(); | ||
// it appears on apple devices this might not be set properly? | ||
if($(inner)[0]){ | ||
var leftOffset = $(inner)[0].offsetLeft +3; | ||
}else{ | ||
var leftOffset = 0; | ||
if(inner.length !== 0){ | ||
var leftOffset = parseInt($(inner).offset().left); | ||
leftOffset = leftOffset + parseInt($(inner).css('padding-left')); | ||
} | ||
var stickUp = false; | ||
@@ -132,3 +131,3 @@ | ||
if ( div.length !== 0 ) { | ||
var top = $(div).offset().top -10; // A standard generic offset | ||
var top = $(div).offset().top; // A standard generic offset | ||
// The problem we have here is we don't know the px X offset of the caret from the user | ||
@@ -143,2 +142,5 @@ // Because that's a blocker for now lets just put a nice little div on the left hand side.. | ||
// We need the offset of the innerdocbody on top too. | ||
top = top + parseInt($('iframe[name="ace_outer"]').contents().find('iframe').css('paddingTop')); | ||
// Get the HTML | ||
@@ -179,2 +181,3 @@ var html = $(div).html(); | ||
}else{ | ||
// empty span. | ||
var left = 0; | ||
@@ -185,3 +188,3 @@ } | ||
var height = worker.height(); // the height of the worker | ||
top = top + height - span.height(); // plus the top offset minus the actual height of our focus span | ||
top = top + height - (span.height() || 12); // plus the top offset minus the actual height of our focus span | ||
if(top <= 0){ // If the tooltip wont be visible to the user because it's too high up | ||
@@ -198,5 +201,4 @@ stickUp = true; | ||
var divMargin = $(div).css("margin-left"); | ||
var innerdocbodyMargin = $(div).parent().css("margin-left"); | ||
var innerdocbodyMargin = $(div).parent().css("padding-left"); | ||
if(innerdocbodyMargin){ | ||
innerdocbodyMargin = innerdocbodyMargin.replace("px", ""); | ||
innerdocbodyMargin = parseInt(innerdocbodyMargin); | ||
@@ -215,3 +217,3 @@ }else{ | ||
} | ||
left = left+20; | ||
left = left+18; | ||
@@ -241,3 +243,4 @@ // Remove the element | ||
// Create a new Div for this author | ||
var $indicator = $("<div class='caretindicator "+ location+ " caret-"+authorClass+"' style='height:16px;left:"+left+"px;top:"+top +"px;background-color:"+color+"' title="+authorName+"><p class='"+location+"'>"+authorName+"</p></div>"); | ||
var $indicator = $("<div class='caretindicator "+ location+ " caret-"+authorClass+"' style='height:16px;left:"+left+"px;top:"+top +"px;background-color:"+color+"' title="+authorName+"><p class='stickp "+location+"'></p></div>"); | ||
$indicator.find("p").text(authorName); | ||
$(outBody).append($indicator); | ||
@@ -255,2 +258,3 @@ | ||
// works on earlier versions of Chrome (< 61) | ||
console.log("newY", newY) | ||
$outerdoc.animate({scrollTop: newY}); | ||
@@ -257,0 +261,0 @@ // works on Firefox & later versions of Chrome (>= 61) |
Sorry, the diff of this file is not supported yet
18757
453