Sha256: bac7b1b15e0df191f960c18c7399bac3302c3e44184dfec673a6c26b3c5bb486

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

(function() {
  if (window.parent !== window) {
    var scrivito_ui = window.parent.scrivito;
    if (scrivito_ui) {
      // In an iframe and parent window contains the UI: in UI mode.
      var cms_document = scrivito_ui.cms_element.from_dom_element(document);
      cms_document.installPublicApi();
      cms_document.add_app_extensions();

      // wait for app to be fully loaded
      document.addEventListener("DOMContentLoaded", function() {
        // wait for UI to be fully loaded
        scrivito_ui.on("load", function() {
          cms_document.assert_user_logged_in();
          cms_document.connect();
        });
      });
    }
  }

  // If the SDK is completely missing, the custom callbacks should nevertheless run.
  if (!window.scrivito) {
    window.scrivito = {
      on: function(event_name, callback) {
        if (event_name === 'content') {
          document.addEventListener("DOMContentLoaded", function() {
            callback(window.document);
          });
        }
      },

      in_editable_view: function() { return false; }
    };
  }
}());

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
scrivito_sdk-1.6.1 lib/assets/javascripts/scrivito.js
scrivito_sdk-1.6.1.rc1 lib/assets/javascripts/scrivito.js
scrivito_sdk-1.6.0 lib/assets/javascripts/scrivito.js
scrivito_sdk-1.6.0.rc5 lib/assets/javascripts/scrivito.js
scrivito_sdk-1.6.0.rc4 lib/assets/javascripts/scrivito.js
scrivito_sdk-1.6.0.rc3 lib/assets/javascripts/scrivito.js
scrivito_sdk-1.6.0.rc2 lib/assets/javascripts/scrivito.js
scrivito_sdk-1.6.0.rc1 lib/assets/javascripts/scrivito.js