Commit 110c8bb7 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Scale down normal (non-inline) tablet examples too.

parent d5a81cc4
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ Ext.define('Docs.view.examples.TouchContainer', {
        Ext.apply(this.example, this.getIFrameSize());

        this.update(this.tpl.apply(this.example));
        this.updateScale();
        this.updateTitle();
        this.updateButtons();
    },
@@ -83,6 +84,19 @@ Ext.define('Docs.view.examples.TouchContainer', {
        this.load(this.example);
    },

    // Scale down the example when in tablet mode
    updateScale: function() {
        if (this.example.device === "tablet") {
            var iframe = Ext.query('iframe', this.el.dom)[0];
            iframe.onload = function() {
                var style = document.createElement("style");
                // default font-size is 114%
                style.innerHTML = "body {font-size: 57% !important}";
                iframe.contentWindow.document.body.appendChild(style);
            };
        }
    },

    updateTitle: function() {
        Ext.get(Ext.query('.example-title')).update(this.example.text + " Example");
    },