<commit_before><!doctype html>
<html>
    <head>
        <title>easyXDM</title>
        <script type="text/javascript" src="../easyXDM.debug.js">
        </script>
        <script type="text/javascript">
            var serializer = {
                /**
                 * Serializes a hashtable and returns it as a string
                 * @param {Object} data The data to serialize
                 * @returns The serialized string
                 * @type {String}
                 */
                stringify: function(data){
                    var message = "";
                    for (var key in data) {
                        if (data.hasOwnProperty(key)) {
                            message += key + "=" + escape(data[key]) + "&";
                        }
                    }
                    return message.substring(0, message.length - 1);
                },
                /**
                 * Deserializes a string and returns a hashtable
                 * @param {String} message The string to deserialize
                 * @returns An hashtable populated with key-value pairs
                 * @type {Object}
                 */
                parse: function(message){
                    var data = {};
                    var d = message.split("&");
                    var pair, key, value;
                    for (var i = 0, len = d.length; i < len; i++) {
                        pair = d[i];
                        key = pair.substring(0, pair.indexOf("="));
                        value = pair.substring(key.length + 1);
                        data[key] = unescape(value);
                    }
                    return data;
                }
            };
            
            var channel;
            var REMOTE = (function(){
                var remote = location.href;
                switch (location.host) {
                    case "provider.easyxdm.net":
                        location.href = remote.replace("provider", "consumer");
                        break;
                    case "easyxdm.net":
                        remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
                        break;
                    case "consumer.easyxdm.net":
                        remote = remote.replace("consumer", "provider");
                        break;
                    case "xdm1":
                        remote = remote.replace("xdm1", "xdm2");
                        break;
                }
                return remote.substring(0, remote.lastIndexOf("/"));
            }());
            window.onload = function(){
                /**
                 * When the window is finished loading start setting up the channel
                 */
                channel = new easyXDM.Socket(/** The configuration */{
                    /**
                     * Register the url to hash.html, this must be an absolute path
                     * or a path relative to the root.
                     * @field
                     */
                    local: "../name.html",
                    /**
                     * Register the url to the remote interface
                     * @field
                     */
                    remote: REMOTE + "/remotedata.html",
                    remoteHelper: REMOTE + "/../name.html",
                    onReady: function(){
                        /**
                         * Send some data to the other side
                         */
                        channel.postMessage(serializer.stringify({
                            propA: "abc",
                            propB: "def",
                            propC: 44
                        }));
                    }
                });
            };
        </script>
    </head>
    <body>
    <div style="border:1px solid black;padding:3px;margin:10px;">
        <a href="index.html">Index of examples</a><commit_msg>Added a missing ref to easyxdm.swf to an example<commit_after><!doctype html>
<html>
    <head>
        <title>easyXDM</title>
        <script type="text/javascript" src="../easyXDM.debug.js">
        </script>
        <script type="text/javascript">
            var serializer = {
                /**
                 * Serializes a hashtable and returns it as a string
                 * @param {Object} data The data to serialize
                 * @returns The serialized string
                 * @type {String}
                 */
                stringify: function(data){
                    var message = "";
                    for (var key in data) {
                        if (data.hasOwnProperty(key)) {
                            message += key + "=" + escape(data[key]) + "&";
                        }
                    }
                    return message.substring(0, message.length - 1);
                },
                /**
                 * Deserializes a string and returns a hashtable
                 * @param {String} message The string to deserialize
                 * @returns An hashtable populated with key-value pairs
                 * @type {Object}
                 */
                parse: function(message){
                    var data = {};
                    var d = message.split("&");
                    var pair, key, value;
                    for (var i = 0, len = d.length; i < len; i++) {
                        pair = d[i];
                        key = pair.substring(0, pair.indexOf("="));
                        value = pair.substring(key.length + 1);
                        data[key] = unescape(value);
                    }
                    return data;
                }
            };
            
            var channel;
            var REMOTE = (function(){
                var remote = location.href;
                switch (location.host) {
                    case "provider.easyxdm.net":
                        location.href = remote.replace("provider", "consumer");
                        break;
                    case "easyxdm.net":
                        remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
                        break;
                    case "consumer.easyxdm.net":
                        remote = remote.replace("consumer", "provider");
                        break;
                    case "xdm1":
                        remote = remote.replace("xdm1", "xdm2");
                        break;
                }
                return remote.substring(0, remote.lastIndexOf("/"));
            }());
            window.onload = function(){
                /**
                 * When the window is finished loading start setting up the channel
                 */
                channel = new easyXDM.Socket(/** The configuration */{
                    /**
                     * Register the url to hash.html, this must be an absolute path
                     * or a path relative to the root.
                     * @field
                     */
                    local: "../name.html",
                    swf: "../easyxdm.swf",
                    /**
                     * Register the url to the remote interface
                     * @field
                     */
                    remote: REMOTE + "/remotedata.html",
                    remoteHelper: REMOTE + "/../name.html",
                    onReady: function(){
                        /**
                         * Send some data to the other side
                         */
                        channel.postMessage(serializer.stringify({
                            propA: "abc",
                            propB: "def",
                            propC: 44
                        }));
                    }
                });
            };
        </script>
    </head>
    <body>
    <div style="border:1px solid black;padding:3px;margin:10px;">
        <a href="index.html">Index of examples</a>
{'fraction_non_alphanumeric': 0.10292265054169816, 'fraction_numerical': 0.003779289493575208, 'mean_word_length': 0.8893384102808186, 'pattern_counts': {'":': 8, '<': 33, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4473564', 'n_tokens_mistral': 1870, 'n_tokens_neox': 1691, 'n_words': 459}