@@ -55,16 +55,14 @@ function loadTable() {
5555
5656 var tableHead = document . createElement ( 'THEAD' ) ;
5757
58- //table.border = '1'
5958 table . appendChild ( tableHead ) ;
6059
61-
62-
6360 var heading = new Array ( ) ;
64- heading [ 0 ] = "Type"
65- heading [ 1 ] = "Description"
66- heading [ 2 ] = "URL"
67- heading [ 3 ] = "Screenshot"
61+ heading [ 0 ] = "" ;
62+ heading [ 1 ] = "Type"
63+ heading [ 2 ] = "Description"
64+ heading [ 3 ] = "URL"
65+ heading [ 4 ] = "Screenshot"
6866
6967 var annotaions = session . getAnnotations ( ) ;
7068
@@ -87,6 +85,25 @@ function loadTable() {
8785 var tr = document . createElement ( 'TR' ) ;
8886 tr . setAttribute ( 'annotationID' , i ) ;
8987
88+ td = document . createElement ( 'TD' ) ;
89+ td . setAttribute ( 'class' , 'centered' ) ;
90+
91+
92+ var img = document . createElement ( 'img' ) ;
93+ img . src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAdVBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA268pkAAAAJ3RSTlMAAggLEhUXGB0gLC0wNjhDR1BZWmVwfoeJkKCot7vAwcfIzdTZ3uBJhIXDAAAAb0lEQVR42qXI2RZAIBSF4WOWzBKZMpT3f0RJLDeufBdnnf3DJZ/nHB5uEG5RtIW+q6c9rouxjrYKZQOPplQn40lsJDw7MxW9ISicCgYGKz4DcdLUIa8wobpG07/QeVXldXfAgwWaNeDraeWuyVaNAwLmC7rL1abXAAAAAElFTkSuQmCC" ;
94+ var annotationType = annotaions [ i ] . getType ( ) ;
95+ img . alt = "Delete " + annotationType ;
96+ img . title = "Delete " + annotationType ;
97+
98+ img . setAttribute ( 'class' , 'deleteBtn' ) ;
99+
100+ td . appendChild ( img ) ;
101+
102+ //var deleteDialog = getDeleteConfirmationDialog(annotationType);
103+ //td.appendChild(deleteDialog);
104+
105+ tr . appendChild ( td ) ;
106+
90107 td = document . createElement ( 'TD' ) ;
91108 td . setAttribute ( 'class' , 'centered' ) ;
92109 var icon = getIconType ( annotaions [ i ] . getType ( ) ) ;
@@ -143,13 +160,14 @@ function loadTable() {
143160
144161function addTableFilters ( ) {
145162 var sessionActivityTable_Props = {
146- col_0 : "select " ,
147- col_1 : "none " ,
163+ col_0 : "none " ,
164+ col_1 : "select " ,
148165 col_2 : "none" ,
149166 col_3 : "none" ,
150- custom_cell_data_cols : [ 0 ] ,
167+ col_4 : "none" ,
168+ custom_cell_data_cols : [ 1 ] ,
151169 custom_cell_data : function ( o , c , i ) {
152- if ( i == 0 ) {
170+ if ( i == 1 ) {
153171 var img = c . getElementsByTagName ( 'img' ) [ 0 ] ;
154172 if ( ! img ) return '' ;
155173 return img . alt ;
@@ -288,9 +306,7 @@ document.addEventListener('DOMContentLoaded', function() {
288306 } )
289307} , false ) ;
290308
291-
292309function addTableListeners ( ) {
293- //var descriptionElements = document.getElementsByClassName('annotationDescription');
294310 $ ( '.annotationDescription' ) . each ( function ( index , el ) {
295311 el . addEventListener ( 'dblclick' , function ( e ) {
296312 e . stopPropagation ( ) ;
@@ -301,6 +317,7 @@ function addTableListeners() {
301317 } ) ;
302318 } ) ;
303319
320+ deleteAnnotationListener ( ) ;
304321} ;
305322
306323
@@ -326,4 +343,66 @@ function updateSessionAnnotation(annotationID, text) {
326343 annotationID : annotationID ,
327344 newName : text
328345 } ) ;
346+ }
347+
348+ function deleteAnnotationListener ( ) {
349+
350+ $ ( '.deleteBtn' ) . each ( function ( index , el ) {
351+ el . addEventListener ( 'click' , function ( e ) {
352+ e . stopPropagation ( ) ;
353+ var row = $ ( this ) . parent ( ) . parent ( 'tr' ) ;
354+
355+ var $divOverlay = $ ( '#divOverlay' ) ;
356+ var bottomWidth = row . css ( 'width' ) ;
357+ var bottomHeight = row . css ( 'height' ) ;
358+ var bottomTop = row . offset ( ) . top ;
359+ var bottomLeft = row . offset ( ) . left ;
360+ var rowPos = row . position ( ) ;
361+ bottomTop = rowPos . top ;
362+ bottomLeft = rowPos . left ;
363+
364+ $divOverlay . css ( {
365+ position : 'absolute' ,
366+ top : bottomTop ,
367+ height : bottomHeight ,
368+ left : bottomLeft ,
369+ width : bottomWidth ,
370+ } ) ;
371+
372+ var annotationID = row . attr ( 'annotationid' )
373+
374+ $ ( '#divOverlay #deleteYes' ) . attr ( 'idAnnotation' , annotationID ) ;
375+
376+ $divOverlay . slideDown ( ) ;
377+
378+ } ) ;
379+ } ) ;
380+
381+ } ;
382+
383+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
384+ var cancelDeleteBtn = document . getElementById ( "cancelDelete" ) ;
385+ cancelDeleteBtn . addEventListener ( 'click' , function ( ) {
386+ $ ( '#divOverlay' ) . slideUp ( ) ;
387+ } ) ;
388+ } ) ;
389+
390+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
391+ var exportbtn = document . getElementById ( "deleteYes" ) ;
392+ exportbtn . addEventListener ( 'click' , function ( e ) {
393+ var idAnnotation = $ ( '#divOverlay #deleteYes' ) . attr ( 'idAnnotation' ) ;
394+
395+ deleteAnnotation ( idAnnotation ) ;
396+
397+ $ ( '#divOverlay' ) . slideUp ( ) ;
398+ } ) ;
399+ } ) ;
400+
401+ function deleteAnnotation ( annotationID ) {
402+ chrome . extension . sendMessage ( {
403+ type : "deleteAnnotation" ,
404+ annotationID : annotationID
405+ } , function ( response ) {
406+ loadData ( ) ;
407+ } ) ;
329408}
0 commit comments