HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/nodejs/turbolinks/src/turbolinks/view.js
// Generated by CoffeeScript 1.12.8
(function() {
  require('./snapshot');

  require('./snapshot_renderer');

  require('./error_renderer');

  Turbolinks.View = (function() {
    function View(delegate) {
      this.delegate = delegate;
      this.htmlElement = document.documentElement;
    }

    View.prototype.getRootLocation = function() {
      return this.getSnapshot().getRootLocation();
    };

    View.prototype.getElementForAnchor = function(anchor) {
      return this.getSnapshot().getElementForAnchor(anchor);
    };

    View.prototype.getSnapshot = function() {
      return Turbolinks.Snapshot.fromHTMLElement(this.htmlElement);
    };

    View.prototype.render = function(arg, callback) {
      var error, isPreview, snapshot;
      snapshot = arg.snapshot, error = arg.error, isPreview = arg.isPreview;
      this.markAsPreview(isPreview);
      if (snapshot != null) {
        return this.renderSnapshot(snapshot, isPreview, callback);
      } else {
        return this.renderError(error, callback);
      }
    };

    View.prototype.markAsPreview = function(isPreview) {
      if (isPreview) {
        return this.htmlElement.setAttribute("data-turbolinks-preview", "");
      } else {
        return this.htmlElement.removeAttribute("data-turbolinks-preview");
      }
    };

    View.prototype.renderSnapshot = function(snapshot, isPreview, callback) {
      return Turbolinks.SnapshotRenderer.render(this.delegate, callback, this.getSnapshot(), Turbolinks.Snapshot.wrap(snapshot), isPreview);
    };

    View.prototype.renderError = function(error, callback) {
      return Turbolinks.ErrorRenderer.render(this.delegate, callback, error);
    };

    return View;

  })();

}).call(this);