1 define(function(require) {
7 footnoteHandler: function(clickHandler) {
8 var mydom = $('<span>')
9 .addClass('canvas-widget canvas-widget-footnote-handle')
10 .css('display', 'inline')
13 mydom.click(function(e) {
20 commentAdnotation: function(node) {
22 DOM: $('<div>').addClass('canvas-widget canvas-widget-comment-adnotation'),
23 update: function(node) {
25 metadata = node.getMetadata(),
27 metadata.forEach(function(row) {
28 parts.push(row.getValue());
30 metadata.some(function(row) {
37 this.DOM.text(parts.join(', '));
43 hideButton: function(clickHandler) {
44 var mydom = $('<span>x</span>')
45 .addClass('canvas-widget canvas-widget-hide-button');
46 mydom.click(function(e) {
57 this.super.init.call(this);
58 this.commentAdnotation = widgets.commentAdnotation(this.wlxmlNode);
59 this.addWidget(this.commentAdnotation, 'show');
60 this.commentAdnotation.DOM.show();
63 onMetadataChanged: function(event) {
64 this.commentAdnotation.update(event.meta.node);
66 onMetadataAdded: function(event) {
67 return this.onMetadataChanged(event);
69 onMetadataRemoved: function(event) {
70 return this.onMetadataChanged(event);
76 this.super.init.call(this);
77 var clickHandler = function() {
80 this.footnoteHandler = widgets.footnoteHandler(clickHandler);
81 this.addWidget(this.footnoteHandler);
83 var closeHandler = function() {
86 this.hideButton = widgets.hideButton(closeHandler);
87 this.addWidget(this.hideButton);
88 this.toggle(false, {silent: true});
90 toggle: function(toggle, options) {
91 options = options || {};
92 this.hideButton.toggle(toggle);
93 this.footnoteHandler.toggle(!toggle);
96 this.displayAsBlock();
100 this._container().toggle(toggle);
101 if(!options.silent) {
102 this.trigger('elementToggled', toggle, this.documentElement);
109 {klass: 'comment', element: comment},
110 {klass: 'footnote', element: footnote}