Skip to content

Commit cee3226

Browse files
author
Philip Guo
committed
more testy
1 parent 6386153 commit cee3226

2 files changed

Lines changed: 86 additions & 4 deletions

File tree

‎v3/commentary-bubbles-demo.css‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,10 @@ textarea.bubbleInputText {
109109

110110
.ui-tooltip-pgbootstrap-stub{
111111
border: 2px solid #999;
112+
113+
/*
114+
-webkit-box-shadow: none;
115+
-moz-box-shadow: none;
116+
box-shadow: none;
117+
*/
112118
}

‎v3/commentary-bubbles-demo.js‎

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,25 @@ AnnotationBubble.prototype.showEditor = function() {
164164
this.state = 'edit';
165165
}
166166

167+
168+
AnnotationBubble.prototype.bindViewerClickHandler = function() {
169+
var myBubble = this;
170+
171+
$(this.qTipID())
172+
.unbind('click') // unbind all old handlers
173+
.click(function() {
174+
if (globalAnnotationMode == 'edit') {
175+
myBubble.showEditor();
176+
}
177+
else if (globalAnnotationMode == 'view') {
178+
myBubble.minimizeViewer();
179+
}
180+
else {
181+
assert(false);
182+
}
183+
});
184+
}
185+
167186
AnnotationBubble.prototype.showViewer = function() {
168187
assert(this.state == 'edit');
169188
assert(this.text); // must be non-empty!
@@ -180,18 +199,32 @@ AnnotationBubble.prototype.showViewer = function() {
180199
}
181200
}));
182201

202+
this.bindViewerClickHandler();
183203
this.state = 'view';
184204
}
185205

206+
186207
AnnotationBubble.prototype.minimizeViewer = function() {
187208
assert(this.state == 'view');
188-
$(this.hashID).qtip('option', 'content.text', ' ');
209+
210+
var myBubble = this;
211+
212+
$(this.hashID).qtip('option', 'content.text', ' '); //hack to "minimize" its size
213+
214+
$(this.qTipID())
215+
.unbind('click') // unbind all old handlers
216+
.click(function() {
217+
assert(globalAnnotationMode == 'view');
218+
myBubble.restoreViewer();
219+
});
220+
189221
this.state = 'minimized';
190222
}
191223

192224
AnnotationBubble.prototype.restoreViewer = function() {
193225
assert(this.state == 'minimized');
194226
$(this.hashID).qtip('option', 'content.text', this.text);
227+
this.bindViewerClickHandler();
195228
this.state = 'view';
196229
}
197230

@@ -201,6 +234,11 @@ AnnotationBubble.prototype.hide = function() {
201234
this.state = 'hidden';
202235
}
203236

237+
238+
AnnotationBubble.prototype.destroyQTip = function() {
239+
$(this.hashID).qtip('destroy');
240+
}
241+
204242
AnnotationBubble.prototype.qTipContentID = function() {
205243
return '#ui-tooltip-' + this.domID + '-content';
206244
}
@@ -209,9 +247,6 @@ AnnotationBubble.prototype.qTipID = function() {
209247
return '#ui-tooltip-' + this.domID;
210248
}
211249

212-
AnnotationBubble.prototype.destroyQTip = function() {
213-
$(this.hashID).qtip('destroy');
214-
}
215250

216251
AnnotationBubble.prototype.enterEditMode = function() {
217252
assert(globalAnnotationMode == 'edit');
@@ -291,7 +326,48 @@ $(document).ready(function() {
291326
inputTextarea, true);
292327
*/
293328

329+
330+
allBubbles.push(new AnnotationBubble('frame', 'v1__globals'));
331+
allBubbles.push(new AnnotationBubble('frame', 'v1__stack0'));
332+
allBubbles.push(new AnnotationBubble('frame', 'v1__stack1'));
294333
allBubbles.push(new AnnotationBubble('frame', 'v1__stack2'));
334+
allBubbles.push(new AnnotationBubble('frame', 'v1__stack3'));
335+
336+
allBubbles.push(new AnnotationBubble('object', 'v1__heap_object_1'));
337+
allBubbles.push(new AnnotationBubble('object', 'v1__heap_object_2'));
338+
allBubbles.push(new AnnotationBubble('object', 'v1__heap_object_3'));
339+
allBubbles.push(new AnnotationBubble('object', 'v1__heap_object_4'));
340+
341+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod1'));
342+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod2'));
343+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod3'));
344+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod4'));
345+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod5'));
346+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod6'));
347+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod7'));
348+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod8'));
349+
allBubbles.push(new AnnotationBubble('codeline', 'v1__cod9'));
350+
351+
allBubbles.push(new AnnotationBubble('variable', 'v1__globals__listSum'));
352+
allBubbles.push(new AnnotationBubble('variable', 'v1__globals__myList'));
353+
354+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f1__numbers'));
355+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f1__f'));
356+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f1__rest'));
357+
358+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f2__numbers'));
359+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f2__f'));
360+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f2__rest'));
361+
362+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f3__numbers'));
363+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f3__f'));
364+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f3__rest'));
365+
366+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f4__numbers'));
367+
allBubbles.push(new AnnotationBubble('variable', 'v1__listSum_f4____return__'));
368+
369+
370+
295371

296372
$('#modeToggleBtn').click(function() {
297373
if (globalAnnotationMode == 'view') {

0 commit comments

Comments
 (0)