ep_comments_page
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"description": "Adds comments on sidebar and link it to the text. Support for Page View, requires ep_page_view", | ||
"name": "ep_comments_page", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Nicolas Lescop", |
@@ -226,3 +226,3 @@ var _, $, jQuery; | ||
var y = ele[0].offsetTop; | ||
$('iframe[name="ace_outer"]').contents().find('#sidediv').contents().find('#newComment').css("top", y+"px"); | ||
$('iframe[name="ace_outer"]').contents().find('#sidediv').contents().find('#newComment').css("top", y+"px").show(); | ||
// scroll new comment form to focus | ||
@@ -259,11 +259,16 @@ $('iframe[name="ace_outer"]').contents().find('#outerdocbody').scrollTop(y); // Works in Chrome | ||
ep_comments.prototype.setYofComments = function(){ | ||
// for each comment | ||
// for each comment in the pad | ||
var padOuter = $('iframe[name="ace_outer"]').contents(); | ||
var padInner = padOuter.find('iframe[name="ace_inner"]'); | ||
var inlineComments = padInner.contents().find(".comment"); | ||
$.each(inlineComments, function(inlineComment){ | ||
padOuter.find("#comments").children().each(function(){ | ||
// hide each outer comment | ||
$(this).hide(); | ||
}); | ||
$.each(inlineComments, function(){ | ||
var y = this.offsetTop; | ||
var commentId = /(?:^| )c-([A-Za-z0-9]*)/.exec(this.className); | ||
var commentEle = padOuter.find('#c-'+commentId[1]); | ||
commentEle.css("top", y+"px"); | ||
y = y+5; | ||
var commentId = /(?:^| )c-([A-Za-z0-9]*)/.exec(this.className); // classname is the ID of the comment | ||
var commentEle = padOuter.find('#c-'+commentId[1]) // find the comment | ||
commentEle.css("top", y+"px").show(); | ||
}); | ||
@@ -336,3 +341,3 @@ }; | ||
// Set the top of the form | ||
$('iframe[name="ace_outer"]').contents().find('#sidediv').contents().find('#newComment').css("top", "200px"); | ||
// $('iframe[name="ace_outer"]').contents().find('#sidediv').contents().find('#newComment').css("top", "200px"); | ||
@@ -390,2 +395,5 @@ this.insertNewComment(data, function (text, index){ | ||
aceEditEvent: function(hook, context){ | ||
// Cake this bit is a bit rough.. | ||
var padOuter = $('iframe[name="ace_outer"]').contents(); | ||
padOuter.find('#sidediv').removeClass("sidedivhidden"); // TEMPORARY to do removing authorship colors can add sidedivhidden class to sidesiv! | ||
if(!context.callstack.docTextChanged) return; | ||
@@ -395,10 +403,14 @@ // for each comment | ||
// NOTE this is duplicate code because of the way this is written, ugh, this needs fixing | ||
var padOuter = $('iframe[name="ace_outer"]').contents(); | ||
var padInner = padOuter.find('iframe[name="ace_inner"]'); | ||
var inlineComments = padInner.contents().find(".comment"); | ||
$.each(inlineComments, function(inlineComment){ | ||
padOuter.find("#comments").children().each(function(){ | ||
// hide each outer comment | ||
$(this).hide(); | ||
}); | ||
$.each(inlineComments, function(){ | ||
var y = this.offsetTop; | ||
var commentId = /(?:^| )c-([A-Za-z0-9]*)/.exec(this.className); | ||
var commentEle = padOuter.find('#c-'+commentId[1]); | ||
commentEle.css("top", y+"px"); | ||
y = y+5; | ||
commentEle.css("top", y+"px").show(); | ||
}); | ||
@@ -405,0 +417,0 @@ }, |
Sorry, the diff of this file is not supported yet
31398
633