<commit_before>define([], function() {
    var DevicePreviewFacade = function(top_node, devices, excludes){

        var that = this;
        var base_url = "/js/vendors/go-device-preview/img/";

        that.default_excludes = [
            ".device",
            "#stryke-db",
            "#qunit",
            "#qunit-fixture",
            "script"
        ];


        that.top_node = $(top_node).length==0?$("body"):$(top_node).first();
        that.device = "";
        that.mode = "landscape";
        that.excludes = [];
        that.excludes = merge(that.default_excludes, excludes);


        function more_param(loc, param_to_update) {
            loc = loc.replace(param_to_update + "&", "");

            if (loc.indexOf("?") == -1) {
                loc += "?" + param_to_update + "";
            } else {
                loc += "&" + param_to_update + "";
            }
            return loc;
        }
        function less_param(loc, param_to_update) {
            var params = param_to_update.split("=");

            if( params[1] == "" ){
                var pattern = ".*[&?]"+params[0]+"=([^&]*)"
                pattern = new RegExp(pattern,"i");
                var matches = loc.match(pattern)
                if ( matches ) {
                    param_to_update = params[0]+"="+matches[1];
                } else {
                    param_to_update = "";
                }
            }

            if( param_to_update != "" ){
                loc = loc.replace(param_to_update + "&", "");
                loc = loc.replace(param_to_update + "", "");

                if (loc.slice(loc.length - 1) == "&")
                    loc = loc.slice(0, loc.length - 1);
                else if (loc.slice(loc.length - 1) == "?")
                    loc = loc.slice(0, loc.length - 1);
            }
            return loc;
        }


        that.wrap_nodes = function(top_node){
            if( $(top_node).children(".device-preview-wrap").length == 0 ){
                var nodes = $("body").children();
                for(var n in that.excludes ){
                    nodes = nodes.not( that.excludes[n] );
                }
                nodes.remove();

                var location = window.location.href;
                location = less_param(location,"device=")
                location = less_param(location,"device_mode=")
                location = less_param(location,"no_dashboard=")
                location = more_param(location,"no_dashboard=true")
                $("style, link").remove();
                $("<link rel='stylesheet' type='text/css' href='/js/vendors/go-device-preview/device-preview.css' /><div class='device-preview-wrap'><iframe class='device-screen' src='"+location+"'></iframe></div>")
                    .appendTo(top_node);
            }
        }
        that.unwrap_nodes = function(top_node){
        }
        that.DoFlip = function(){
            $('.device-screen').css("overflow-y", "");
            $('.device-screen').css( "width", "" );
            $('.device-screen').data("w", null);
            $(".device").removeClass(that.mode);
            that.mode = that.mode=="portrait"?"landscape":"portrait";
            that.EnableDevice(that.device)<commit_msg>code format<commit_after>define([], function() {
    var DevicePreviewFacade = function(top_node, devices, excludes){

        var that = this;
        var base_url = "/js/vendors/go-device-preview/img/";

        that.default_excludes = [
            ".device",
            "#stryke-db",
            "#qunit",
            "#qunit-fixture",
            "script"
        ];


        that.top_node = $(top_node).length==0?$("body"):$(top_node).first();
        that.device = "";
        that.mode = "landscape";
        that.excludes = [];
        that.excludes = merge(that.default_excludes, excludes);


        function more_param(loc, param_to_update) {
            loc = loc.replace(param_to_update + "&", "");

            if (loc.indexOf("?") == -1) {
                loc += "?" + param_to_update + "";
            } else {
                loc += "&" + param_to_update + "";
            }
            return loc;
        }
        function less_param(loc, param_to_update) {
            var params = param_to_update.split("=");

            if( params[1] == "" ){
                var pattern = ".*[&?]"+params[0]+"=([^&]*)"
                pattern = new RegExp(pattern,"i");
                var matches = loc.match(pattern)
                if ( matches ) {
                    param_to_update = params[0]+"="+matches[1];
                } else {
                    param_to_update = "";
                }
            }

            if( param_to_update != "" ){
                loc = loc.replace(param_to_update + "&", "");
                loc = loc.replace(param_to_update + "", "");

                if (loc.slice(loc.length - 1) == "&")
                    loc = loc.slice(0, loc.length - 1);
                else if (loc.slice(loc.length - 1) == "?")
                    loc = loc.slice(0, loc.length - 1);
            }
            return loc;
        }


        that.wrap_nodes = function(top_node){
            if( $(top_node).children(".device-preview-wrap").length == 0 ){
                var nodes = $("body").children();
                for(var n in that.excludes ){
                    nodes = nodes.not( that.excludes[n] );
                }
                nodes.remove();

                var location = window.location.href;
                location = less_param(location,"device=")
                location = less_param(location,"device_mode=")
                location = less_param(location,"no_dashboard=")
                location = more_param(location,"no_dashboard=true")
                $("<link rel='stylesheet' type='text/css' href='/js/vendors/go-device-preview/device-preview.css' />")
                    .appendTo(top_node);
                $("<div class='device-preview-wrap'><iframe class='device-screen' src='"+location+"'></iframe></div>")
                    .appendTo(top_node);
            }
        }
        that.unwrap_nodes = function(top_node){
        }
        that.DoFlip = function(){
            $('.device-screen').css("overflow-y", "");
            $('.device-screen').css( "width", "" );
            $('.device-screen').data("w", null);
            $(".device").removeClass(that.mode);
            that.mode = that.mode=="portrait"?"landscape":"portrait";
            that.EnableDevice(that.device)
{'fraction_non_alphanumeric': 0.16533127889060092, 'fraction_numerical': 0.004006163328197226, 'mean_word_length': 1.5494893951296151, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '9182', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1815, 'n_words': 279}