dist/crocodoc.viewer.js
function prepareDOM() {
        var i, pageNum,
            zoomLevel, maxZoom,
            ptWidth, ptHeight,
            pxWidth, pxHeight,
            pt2px = util.calculatePtSize(),
            dimensions = config.metadata.dimensions,
            skeleton = '';

        // adjust page scale if the pages are too small/big
        // it's adjusted so 100% == DOCUMENT_100_PERCENT_WIDTH px;
        config.pageScale = DOCUMENT_100_PERCENT_WIDTH / (dimensions.width * pt2px);

        // add zoom levels to accomodate the scale
        zoomLevel = config.zoomLevels[config.zoomLevels.length - 1];
        maxZoom = 3 / config.pageScale;
        while (zoomLevel < maxZoom) {
            zoomLevel += zoomLevel / 2;
            config.zoomLevels.push(zoomLevel);
        }

        dimensions.exceptions = dimensions.exceptions || {};

        // create skeleton
        for (i = config.pageStart - 1; i < config.pageEnd; i++) {
            pageNum = i + 1;
            if (pageNum in dimensions.exceptions) {
                ptWidth = dimensions.exceptions[pageNum].width;
                ptHeight = dimensions.exceptions[pageNum].height;
            } else {
                ptWidth = dimensions.width;
                ptHeight = dimensions.height;
            }
            pxWidth = ptWidth * pt2px;
            pxHeight = ptHeight * pt2px;
            pxWidth *= config.pageScale;
            pxHeight *= config.pageScale;
            skeleton += util.template(Crocodoc.pageTemplate, {
                w: pxWidth,
                h: pxHeight
            });
        }

        // insert skeleton and keep a reference to the jq object
        config.$pages = $(skeleton).appendTo(config.$doc);
    }
function prepareDOM() {
        var i, pageNum,
            zoomLevel, maxZoom,
            ptWidth, ptHeight,
            pxWidth, pxHeight,
            pt2px = util.calculatePtSize(),
            dimensions = config.metadata.dimensions,
            skeleton = '';

        // adjust page scale if the pages are too small/big
        // it's adjusted so 100% == DOCUMENT_100_PERCENT_WIDTH px;
        config.pageScale = DOCUMENT_100_PERCENT_WIDTH / (dimensions.width * pt2px);

        // add zoom levels to accomodate the scale
        zoomLevel = config.zoomLevels[config.zoomLevels.length - 1];
        maxZoom = 3 / config.pageScale;
        while (zoomLevel < maxZoom) {
            zoomLevel += zoomLevel / 2;
            config.zoomLevels.push(zoomLevel);
        }

        dimensions.exceptions = dimensions.exceptions || {};

        // create skeleton
        for (i = config.pageStart - 1; i < config.pageEnd; i++) {
            pageNum = i + 1;
            if (pageNum in dimensions.exceptions) {
                ptWidth = dimensions.exceptions[pageNum].width;
                ptHeight = dimensions.exceptions[pageNum].height;
            } else {
                ptWidth = dimensions.width;
                ptHeight = dimensions.height;
            }
            pxWidth = ptWidth * pt2px;
            pxHeight = ptHeight * pt2px;
            pxWidth *= config.pageScale;
            pxHeight *= config.pageScale;
            skeleton += util.template(Crocodoc.pageTemplate, {
                w: pxWidth,
                h: pxHeight
            });
        }

        // insert skeleton and keep a reference to the jq object
        config.$pages = $(skeleton).appendTo(config.$doc);
    }
function prepareDOM ( ) { var i , pageNum , zoomLevel , maxZoom , ptWidth , ptHeight , pxWidth , pxHeight , pt2px = util . calculatePtSize ( ) , dimensions = config . metadata . dimensions , skeleton = '' ; // adjust page scale if the pages are too small/big // it's adjusted so 100% == DOCUMENT_100_PERCENT_WIDTH px; config . pageScale = DOCUMENT_100_PERCENT_WIDTH / ( dimensions . width * pt2px ) ; // add zoom levels to accomodate the scale zoomLevel = config . zoomLevels [ config . zoomLevels . length - 1 ] ; maxZoom = 3 / config . pageScale ; while ( zoomLevel < maxZoom ) { zoomLevel += zoomLevel / 2 ; config . zoomLevels . push ( zoomLevel ) ; } dimensions . exceptions = dimensions . exceptions || { } ; // create skeleton for ( i = config . pageStart - 1 ; i < config . pageEnd ; i ++ ) { pageNum = i + 1 ; if ( pageNum in dimensions . exceptions ) { ptWidth = dimensions . exceptions [ pageNum ] . width ; ptHeight = dimensions . exceptions [ pageNum ] . height ; } else { ptWidth = dimensions . width ; ptHeight = dimensions . height ; } pxWidth = ptWidth * pt2px ; pxHeight = ptHeight * pt2px ; pxWidth *= config . pageScale ; pxHeight *= config . pageScale ; skeleton += util . template ( Crocodoc . pageTemplate , { w : pxWidth , h : pxHeight } ) ; } // insert skeleton and keep a reference to the jq object config . $pages = $ ( skeleton ) . appendTo ( config . $doc ) ; }
Create the html skeleton for the viewer and pages
@returns {void}
@private
Create the html skeleton for the viewer and pages