- function AnnotationsPerspective(options){
- var old_callback = options.callback || function() { };
-
- this.noupdate_hash_onenter = true;
- this.vsplitbar = 'PRZYPISY';
-
- options.callback = function(){
- var self = this;
-
- this.$element = $("#side-annotations");
- this.$error = $('.error-message', this.$element);
- this.$annos = $('.annotations-list', this.$element);
- this.$spinner = $('.spinner', this.$element);
- this.$refresh = $('.refresh', this.$element);
-
- this.$refresh.click(function() {
- var $this = $(this);
-
- self.$refresh.removeClass('active');
- $this.addClass('active');
- var atype = $this.attr('data-tag');
-
- self.$annos.hide();
- self.$error.hide();
- self.$spinner.show(100, function(){
- self.refresh(self, atype);
- });
- });
-
- old_callback.call(this);
- };
-
- $.wiki.Perspective.call(this, options);
- }
-
- AnnotationsPerspective.prototype = new $.wiki.Perspective();
-
- AnnotationsPerspective.prototype.updateAnnotationIds = function(self){
- self.annotationToAnchor = {};
- $('#html-view').find('.annotation-inline-box').each(
- function(i, annoBox) {
- var $annoBox = $(annoBox);
- var $anchor = $("a[name|=anchor]", $annoBox);
- var htmlContent = $('span', $annoBox).html();
- // TBD: perhaps use a hash of htmlContent as key
- self.annotationToAnchor[htmlContent] = $anchor.attr('name');
+ class AnnotationsPerspective extends $.wiki.SidebarPerspective {
+ constructor(options) {
+ var old_callback = options.callback || function() { };
+
+ options.callback = function(){
+ var self = this;
+
+ this.vsplitbar = 'PRZYPISY';
+ this.$element = $("#side-annotations");
+ this.$error = $('.error-message', this.$element);
+ this.$annos = $('.annotations-list', this.$element);
+ this.$spinner = $('.spinner', this.$element);
+ this.$refresh = $('.refresh', this.$element);
+
+ this.$refresh.click(function() {
+ var $this = $(this);
+
+ self.$refresh.removeClass('active');
+ $this.addClass('active');
+ var atype = $this.attr('data-tag');
+
+ self.$annos.hide();
+ self.$error.hide();
+ self.$spinner.fadeIn(100, function() {
+ self.refresh(atype);
+ });