ui.fullScreen

webix.ui.fullScreen([see official doc])

webix.ui.fullScreen helper.

Please look into the linked official documentation.

References

helpers
copy(), delay(), addMeta(), ui(), resize().

External references

Official documentation page.

Code

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
webix.ui.fullScreen = function(){
    if (!webix.env.touch) return;

    webix.html.addMeta("apple-mobile-web-app-capable","yes");
    webix.html.addMeta("viewport","initial-scale=1, maximum-scale=1, user-scalable=no");

    //in ios5 we can have empty offsetHeight just after page loading
    var size = document.body.offsetHeight||document.body.scrollHeight;

    var iphone = navigator.userAgent.indexOf("iPhone")!=-1;
    var ipad = navigator.userAgent.indexOf("iPad")!=-1;

    var version = navigator.userAgent.match(/iPhone OS (\d+)/);
    var iOS7 = version&&(version[1]>=7);


    var iphone_safari = iphone && (size == 356 || size == 208 || size == 306 || size == 158 || size == 444);
    var iphone5 = (window.screen.height==568);

    var fix = function(){
        var x = 0; var y=0;
        if (iphone && !iOS7){
            if (!webix.ui.orientation){
                x = 320;
                y = iphone5?(iphone_safari?504:548):(iphone_safari?416:460);
            } else {
                x = iphone5?568:480;
                y = iphone_safari?268:300;
            }
        } else if (webix.env.isAndroid){

            if(!webix.env.isFF){
                //ipad doesn't change orientation and zoom level, so just ignore those lines
                document.body.style.width = document.body.style.height = "1px";
                document.body.style.overflow="hidden";

                var dmod = window.outerWidth/window.innerWidth; //<1
                x = window.outerWidth/dmod;
                y = window.outerHeight/dmod;
            }
        } else if(!webix.env.isIEMobile){
            x = window.innerWidth;
            y = window.innerHeight;
        }

        if (y){
            document.body.style.height = y+"px";
            document.body.style.width = x+"px";
        }

        webix.ui.$freeze = false;
        webix.ui.resize();
    };

    var onrotate = function(){
        webix.ui.$freeze = true;
        if(webix.env.isSafari)
            fix();
        else
            webix.delay(fix,null, [], 500);
    };


    webix.attachEvent("onRotate", onrotate);
    orientation();
    webix.delay(onrotate);

};


})();
(function(){

if (window.jQuery){

    var $ = jQuery;
    var methods = [];

    var get_id = function(node){
        if (node && node.getAttribute)
            return node.getAttribute("view_id");
    };

    var get_helper = function(name){
        return function(config){
            if (typeof(config) === 'string') {
                if (methods[config] ) {
                    return methods[config].apply(this, []);
                }else {
                    $.error('Method ' +  config + ' does not exist on jQuery.'.name);
                }
            } else {
                var views = [];
                this.each(function() {
                    var view;
                    var id;

                    //if target a webix component - return it
                    var id = get_id(this) || get_id(this.firstChild);
                    if (id)
                        view = webix.$$(id);

                    if (!view){
                        //do not include data in copy as it can be massive
                        var temp_data = config?config.data:0;
                        if (temp_data) config.data = null;

                        var copy = webix.copy(config||{ autoheight:true, autowidth:true });
                        copy.view = name;
                        if (temp_data) config.data = copy.data = temp_data;


                        if (this.tagName.toLowerCase() === 'table') {
                            var div = webix.html.create("div",{
                                id:(this.getAttribute("id")||""),
                                "class":(this.getAttribute("class")||"")
                            },"");

                            this.parentNode.insertBefore(div, this);
                            copy.container = div;
                            view = webix.ui(copy);
                            view.parse(this, "htmltable");
                        } else {
                            copy.container = this;
                            view = webix.ui(copy);
                        }
                    }
                    views.push(view);
                });

                if (views.length === 1) return views[0];
                return views;
            }
        };
    };

    var run = function(){
        for (var key in webix.ui){
            var name = "webix_"+key;
            if (!$.fn[name])
                $.fn[name] = get_helper(key);
        }
    };

    run();
    $(run);

}

})();

/*
    Behavior:History - change multiview state on 'back' button

 */