- function HistoryPerspective(options) {
- var old_callback = options.callback || function() {};
-
- options.callback = function() {
- var self = this;
- if (CurrentDocument.diff) {
- rev_from = CurrentDocument.diff[0];
- rev_to = CurrentDocument.diff[1];
- this.doc.fetchDiff({
- from: rev_from,
- to: rev_to,
- success: function(doc, data){
- var result = $.wiki.newTab(doc, ''+rev_from +' -> ' + rev_to, 'DiffPerspective');
-
- $(result.view).html(data);
- $.wiki.switchToTab(result.tab);
- }
- });
- }
-
- // first time page is rendered
- $('#make-diff-button').click(function() {
- self.makeDiff();
- });
-
- $('#pubmark-changeset-button').click(function() {
- self.showPubmarkForm();
- });
-
- $('#doc-revert-button').click(function() {
- self.revertDialog();
- });
-
- $('#open-preview-button').click(function(event) {
- var selected = $('#changes-list .entry.selected');
-
- if (selected.length != 1) {
- window.alert("Wybierz dokładnie *jedną* wersję.");
- return;
- }
-
- var version = parseInt($("*[data-stub-value='version']", selected[0]).text());
- window.open($(this).attr('data-basehref') + "?revision=" + version);
+ class HistoryPerspective extends $.wiki.Perspective {
+ constructor(options) {
+ var old_callback = options.callback || function() {};
+
+ options.callback = function() {
+ var self = this;
+ if (CurrentDocument.diff) {
+ rev_from = CurrentDocument.diff[0];
+ rev_to = CurrentDocument.diff[1];
+ this.doc.fetchDiff({
+ from: rev_from,
+ to: rev_to,
+ success: function(doc, data){
+ var result = $.wiki.newTab(doc, ''+rev_from +' -> ' + rev_to, 'DiffPerspective');
+
+ $(result.view).html(data);
+ $.wiki.switchToTab(result.tab);
+ }
+ });
+ }