Outline.prototype.openReadingMode = function()

in lib/@uncharted/strippets/src/strippets.outline.js [599:630]


Outline.prototype.openReadingMode = function() {
    var s = this;
    var promises = [];

    s.showEntities('hide');

    promises.push(s.reader.open().then(function() {
        if (!s.readerData) {
            return s.loadReadingModeContent();
        }
        return undefined;
    }));

    if (s.styles.outlineItem.reading) {
        promises.push(s.$outline.velocity({
            'margin-right': s.styles.outlineItem.reading.getPropertyValue('margin-right'),
            'margin-left': s.styles.outlineItem.reading.getPropertyValue('margin-left'),
        }));
    }

    promises.push(
        s.mediator.publish(s.events.outline.CenterElement, {
            $element: s.$outlineContainer,
            expectedWidth: s.getTransitionSizes('readingmode').anticipated.width,
            id: s._id,
        })
    );

    return Promise.all(promises).then(function() {
        s.showEntities('show');
    });
};