Guest User

Untitled

a guest
Nov 15th, 2021
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2. (function() {
  3.   var tmp;
  4.   var options;
  5.   var done;
  6.   var download;
  7.   var r;
  8.   var elem;
  9.   var err;
  10.   var ca;
  11.   var $;
  12.   var sum;
  13.   var success;
  14.   var boxChild;
  15.   var J;
  16.   var add;
  17.   var yw;
  18.   var times;
  19.   var total;
  20.   var count;
  21.   var title;
  22.   var Peer;
  23.   var progressElement;
  24.   var SessionDescription;
  25.   var aminoAcidSpan;
  26.   var response;
  27.   var div;
  28.   var digitPar;
  29.   var y;
  30.   var yi;
  31.   options = {
  32.     iceServers : [{
  33.       url : "stun:stun01.sipphone.com"
  34.     }, {
  35.       url : "stun:stun.ekiga.net"
  36.     }, {
  37.       url : "stun:stun.fwdnet.net"
  38.     }, {
  39.       url : "stun:stun.ideasip.com"
  40.     }, {
  41.       url : "stun:stun.iptel.org"
  42.     }, {
  43.       url : "stun:stun.rixtelecom.se"
  44.     }, {
  45.       url : "stun:stun.schlund.de"
  46.     }, {
  47.       url : "stun:stun.l.google.com:19302"
  48.     }, {
  49.       url : "stun:stun1.l.google.com:19302"
  50.     }, {
  51.       url : "stun:stun2.l.google.com:19302"
  52.     }, {
  53.       url : "stun:stun3.l.google.com:19302"
  54.     }, {
  55.       url : "stun:stun4.l.google.com:19302"
  56.     }, {
  57.       url : "stun:stunserver.org"
  58.     }, {
  59.       url : "stun:stun.softjoys.com"
  60.     }, {
  61.       url : "stun:stun.voiparound.com"
  62.     }, {
  63.       url : "stun:stun.voipbuster.com"
  64.     }, {
  65.       url : "stun:stun.voipstunt.com"
  66.     }, {
  67.       url : "stun:stun.voxgratia.org"
  68.     }]
  69.   };
  70.   /**
  71.    * @param {number} value
  72.    * @return {?}
  73.    */
  74.   ca = function(value) {
  75.     return 1E9 < value ? Math.round(value / 1E7) / 100 + " GBps" : 1E6 < value ? Math.round(value / 1E4) / 100 + " MBps" : 1E3 < value ? Math.round(value / 10) / 100 + " KBps" : Math.round(value) + " Bps";
  76.   };
  77.   /**
  78.    * @param {number} t
  79.    * @return {?}
  80.    */
  81.   $ = function(t) {
  82.     return 86400 < t ? "More than 24 hours" : 3600 < t ? Math.floor(t / 3600) + " hour(s) and " + Math.floor(t / 60 % 60) + " minute(s)" : 60 < t ? Math.floor(t / 60) + " minute(s) and " + Math.floor(t % 60) + " second(s)" : Math.floor(t) + " second(s)";
  83.   };
  84.   /** @type {(Element|null)} */
  85.   elem = document.getElementById("dropzone");
  86.   /** @type {(Element|null)} */
  87.   response = document.getElementById("status");
  88.   /** @type {(Element|null)} */
  89.   div = document.getElementById("substatus");
  90.   /** @type {(Element|null)} */
  91.   digitPar = document.getElementById("subsubstatus");
  92.   /** @type {(Element|null)} */
  93.   title = document.getElementById("password");
  94.   /** @type {(Element|null)} */
  95.   download = document.getElementById("download");
  96.   /** @type {(Element|null)} */
  97.   r = document.getElementById("download2");
  98.   /** @type {(Element|null)} */
  99.   boxChild = document.getElementById("hud");
  100.   /** @type {(Element|null)} */
  101.   aminoAcidSpan = document.getElementById("speed");
  102.   /** @type {(Element|null)} */
  103.   tmp = document.getElementById("ETA");
  104.   /** @type {(Element|null)} */
  105.   progressElement = document.getElementById("progress");
  106.   Peer = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection || window.msRTCPeerConnection;
  107.   SessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription || window.webkitRTCSessionDescription || ["window.msRTCSessionDescription"];
  108.   if (!(Peer && SessionDescription)) {
  109.     /** @type {string} */
  110.     elem.style.display = "none";
  111.     /** @type {string} */
  112.     response.innerHTML = "Your browser is not supported, consider downloading Chrome.";
  113.   }
  114.   if ("/" !== window.location.href[window.location.href.length - 1]) {
  115.     /** @type {string} */
  116.     elem.style.display = "none";
  117.     /** @type {string} */
  118.     title.style.display = "block";
  119.   }
  120.   elem.addEventListener("dragover", function(event) {
  121.     event.stopPropagation();
  122.     event.preventDefault();
  123.     return elem.style["background-color"] = "#ddd";
  124.   });
  125.   elem.addEventListener("dragexit", function(event) {
  126.     event.stopPropagation();
  127.     return event.preventDefault();
  128.   });
  129.   elem.addEventListener("drop", function(event) {
  130.     event.stopPropagation();
  131.     event.preventDefault();
  132.     /** @type {string} */
  133.     elem.style["background-color"] = "";
  134.     return window.ship(event.dataTransfer.files);
  135.   });
  136.   /** @type {null} */
  137.   err = done = null;
  138.   /** @type {number} */
  139.   yw = yi = y = 0;
  140.   /** @type {boolean} */
  141.   J = false;
  142.   /** @type {!Array} */
  143.   times = [];
  144.   /** @type {number} */
  145.   count = sum = total = 0;
  146.   /** @type {string} */
  147.   progressElement.style.width = "0";
  148.   /**
  149.    * @return {undefined}
  150.    */
  151.   add = function() {
  152.     /** @type {number} */
  153.     yw = yi = y = 0;
  154.     /** @type {boolean} */
  155.     J = false;
  156.     /** @type {!Array} */
  157.     times = [];
  158.     /** @type {number} */
  159.     count = sum = total = 0;
  160.     /** @type {string} */
  161.     progressElement.style.width = "0";
  162.   };
  163.   /**
  164.    * @return {?}
  165.    */
  166.   success = function() {
  167.     if (J) {
  168.       times.unshift(yi - yw);
  169.       if (0 === times[0]) {
  170.         if (count = count + 1, 10 < count) {
  171.           /** @type {string} */
  172.           err = "Disconnected unexpectedly";
  173.           done();
  174.           /** @type {boolean} */
  175.           J = false;
  176.           return;
  177.         }
  178.       } else {
  179.         /** @type {number} */
  180.         count = 0;
  181.       }
  182.       yw = yi;
  183.       sum = sum + times[0];
  184.       if (30 < times.length) {
  185.         /** @type {number} */
  186.         sum = sum - times[30];
  187.       }
  188.       total = total + times[0];
  189.       if (60 < times.length) {
  190.         /** @type {number} */
  191.         total = total - times.pop();
  192.       }
  193.       /** @type {number} */
  194.       var i = .1 * times[0] + .2 * sum / Math.min(30, times.length) + .7 * total / Math.min(60, times.length);
  195.       /** @type {number} */
  196.       var h = (y - yi) / i;
  197.       aminoAcidSpan.innerHTML = ca(i);
  198.       tmp.innerHTML = $(h);
  199.       /** @type {string} */
  200.       progressElement.style.width = Math.round(100 * yi / y) + "%";
  201.       return setTimeout(success, 1E3);
  202.     }
  203.   };
  204.   /**
  205.    * @param {!NodeList} body
  206.    * @return {?}
  207.    */
  208.   window.ship = function(body) {
  209.     var tmp;
  210.     /** @type {string} */
  211.     response.innerHTML = "Generating Link, Please Wait...";
  212.     /** @type {string} */
  213.     div.innerHTML = "";
  214.     /** @type {string} */
  215.     div.style.display = "inline-block";
  216.     /** @type {string} */
  217.     elem.style.display = "none";
  218.     /** @type {null} */
  219.     var data = null;
  220.     /** @type {boolean} */
  221.     var t = false;
  222.     var peer = new Peer(options);
  223.     var channel = peer.createDataChannel("data");
  224.     /** @type {string} */
  225.     channel.binaryType = "arraybuffer";
  226.     /** @type {boolean} */
  227.     var actual = tmp = false;
  228.     /** @type {string} */
  229.     err = "Connection closed";
  230.     /** @type {number} */
  231.     channel.bufferedAmountLowThreshold = 5E6;
  232.     /** @type {number} */
  233.     var start = 0;
  234.     /** @type {!Array} */
  235.     var u = [];
  236.     /** @type {!Array} */
  237.     var keys = [];
  238.     /** @type {!Array} */
  239.     var _sizeAnimateTimeStamps = [];
  240.     /** @type {null} */
  241.     var r = null;
  242.     /** @type {number} */
  243.     var i = 0;
  244.     /** @type {number} */
  245.     var testHtml = -2;
  246.     add();
  247.     /**
  248.      * @param {?} positionError
  249.      * @return {?}
  250.      */
  251.     var fail = function(positionError) {
  252.       return console.log(positionError);
  253.     };
  254.     /**
  255.      * @return {?}
  256.      */
  257.     var send = function() {
  258.       if (!tmp && (actual || "complete" === peer.iceGatheringState)) {
  259.         /** @type {!XMLHttpRequest} */
  260.         var xhr = new XMLHttpRequest;
  261.         xhr.open("POST", "/link", true);
  262.         xhr.setRequestHeader("Content-Type", "application/json");
  263.         /**
  264.          * @return {?}
  265.          */
  266.         xhr.onload = function() {
  267.           if (4 === xhr.readyState) {
  268.             if (200 !== xhr.status) {
  269.               response.innerHTML(xhr.responseText);
  270.             } else {
  271.               /** @type {*} */
  272.               var file = JSON.parse(xhr.responseText);
  273.               data = file.password;
  274.               /** @type {string} */
  275.               response.innerHTML = "Leave the tab open and share the URL...";
  276.               /** @type {string} */
  277.               div.innerHTML = "<p><u><b>Download URL</b></u>: " + (window.location.href + file.link) + "</p>\n<p><u><b>Password</b></u>: " + data + "</p>";
  278.               /**
  279.                * @return {?}
  280.                */
  281.               var done = function() {
  282.                 /** @type {!XMLHttpRequest} */
  283.                 xhr = new XMLHttpRequest;
  284.                 /** @type {number} */
  285.                 xhr.timeout = 5E3;
  286.                 xhr.open("GET", "/link?id=" + file.link + "&password=" + data, true);
  287.                 xhr.setRequestHeader("Content-Type", "application/json");
  288.                 /**
  289.                  * @return {?}
  290.                  */
  291.                 xhr.ontimeout = function() {
  292.                   return done();
  293.                 };
  294.                 /**
  295.                  * @return {?}
  296.                  */
  297.                 xhr.onload = function() {
  298.                   var sdp;
  299.                   if (4 === xhr.readyState) {
  300.                     if (200 !== xhr.status) {
  301.                       response.innerHTML = xhr.responseText;
  302.                     } else {
  303.                       return (sdp = JSON.parse(xhr.responseText).answer) ? peer.setRemoteDescription(new SessionDescription(sdp)) : setTimeout(done, 2500);
  304.                     }
  305.                   }
  306.                 };
  307.                 return xhr.send();
  308.               };
  309.               return done();
  310.             }
  311.           }
  312.         };
  313.         xhr.send(JSON.stringify(peer.localDescription));
  314.         return tmp = true;
  315.       }
  316.     };
  317.     /**
  318.      * @return {?}
  319.      */
  320.     var set = function() {
  321.       var _results;
  322.       /** @type {!Array} */
  323.       _results = [];
  324.       for (; 0 < keys.length && 15E6 > channel.bufferedAmount;) {
  325.         var chunk = keys.shift();
  326.         channel.send(chunk);
  327.         if ("string" !== typeof chunk) {
  328.           _results.push(start = start - chunk.byteLength);
  329.         } else {
  330.           testHtml = testHtml + 1;
  331.           _results.push(div.innerHTML = testHtml + " files sent so far");
  332.         }
  333.       }
  334.       return _results;
  335.     };
  336.     /**
  337.      * @return {?}
  338.      */
  339.     var init = function() {
  340.       var exports;
  341.       /** @type {!Array} */
  342.       exports = [];
  343.       for (; 0 < u.length && 125E6 > start;) {
  344.         var dir = u.shift();
  345.         exports.push(function(file) {
  346.           /** @type {!FileReader} */
  347.           var reader = new FileReader;
  348.           /**
  349.            * @return {?}
  350.            */
  351.           reader.onload = function() {
  352.             var _l;
  353.             var timeoutIndex;
  354.             keys.push(JSON.stringify({
  355.               name : file.name,
  356.               size : file.size,
  357.               type : file.type
  358.             }));
  359.             /** @type {!Array} */
  360.             var _results = [];
  361.             /** @type {number} */
  362.             var bookmarkedArrayMaxLength = _l = 0;
  363.             /** @type {number} */
  364.             timeoutIndex = Math.ceil(reader.result.byteLength / 16E3) - 1;
  365.             for (; 0 <= timeoutIndex ? _l <= timeoutIndex : _l >= timeoutIndex; bookmarkedArrayMaxLength = 0 <= timeoutIndex ? ++_l : --_l) {
  366.               _results.push(keys.push(reader.result.slice(16E3 * bookmarkedArrayMaxLength, 16E3 * (bookmarkedArrayMaxLength + 1))));
  367.             }
  368.             return _results;
  369.           };
  370.           /**
  371.            * @return {?}
  372.            */
  373.           reader.onerror = function() {
  374.             /** @type {string} */
  375.             err = "Failed to read file";
  376.             return channel.close();
  377.           };
  378.           reader.readAsArrayBuffer(file);
  379.           return start = start + file.size;
  380.         }(dir));
  381.       }
  382.       return exports;
  383.     };
  384.     /**
  385.      * @return {?}
  386.      */
  387.     var loadFile = function() {
  388.       var res;
  389.       /** @type {!Array} */
  390.       res = [];
  391.       for (; (r || 0 < _sizeAnimateTimeStamps.length) && 125E6 > start;) {
  392.         if (!r) {
  393.           r = _sizeAnimateTimeStamps.shift();
  394.           /** @type {number} */
  395.           i = 0;
  396.           keys.push(JSON.stringify({
  397.             name : r.name,
  398.             size : r.size,
  399.             type : r.type
  400.           }));
  401.         }
  402.         /** @type {!FileReader} */
  403.         var reader = new FileReader;
  404.         /**
  405.          * @return {?}
  406.          */
  407.         reader.onload = function() {
  408.           var _l;
  409.           var timeoutIndex;
  410.           /** @type {!Array} */
  411.           var _results = [];
  412.           /** @type {number} */
  413.           var bookmarkedArrayMaxLength = _l = 0;
  414.           /** @type {number} */
  415.           timeoutIndex = Math.ceil(reader.result.byteLength / 16E3) - 1;
  416.           for (; 0 <= timeoutIndex ? _l <= timeoutIndex : _l >= timeoutIndex; bookmarkedArrayMaxLength = 0 <= timeoutIndex ? ++_l : --_l) {
  417.             _results.push(keys.push(reader.result.slice(16E3 * bookmarkedArrayMaxLength, 16E3 * (bookmarkedArrayMaxLength + 1))));
  418.           }
  419.           return _results;
  420.         };
  421.         /**
  422.          * @return {?}
  423.          */
  424.         reader.onerror = function() {
  425.           /** @type {string} */
  426.           err = "Failed to read file";
  427.           return channel.close();
  428.         };
  429.         var blob = r.slice(125E6 * i, 125E6 * (i + 1));
  430.         reader.readAsArrayBuffer(blob);
  431.         start = start + blob.size;
  432.         if (i === Math.ceil(r.size / 125E6) - 1) {
  433.           res.push(r = null);
  434.         } else {
  435.           res.push(i = i + 1);
  436.         }
  437.       }
  438.       return res;
  439.     };
  440.     /**
  441.      * @return {?}
  442.      */
  443.     var getInnerText = function() {
  444.       if (0 < keys.length) {
  445.         set();
  446.       }
  447.       if (9E7 > start) {
  448.         if (0 < u.length) {
  449.           return init();
  450.         }
  451.         if (0 < _sizeAnimateTimeStamps.length || r) {
  452.           return loadFile();
  453.         }
  454.         if (0 === keys.length) {
  455.           /**
  456.            * @return {?}
  457.            */
  458.           var flush = function() {
  459.             return 0 === channel.bufferedAmount && null !== data ? (data = null, testHtml = testHtml + 1, div.innerHTML = testHtml + " files sent", setTimeout(function() {
  460.               return channel.close();
  461.             }, 1E3)) : setTimeout(flush, 100);
  462.           };
  463.           return flush();
  464.         }
  465.       }
  466.     };
  467.     /**
  468.      * @return {?}
  469.      */
  470.     done = function() {
  471.       peer.close();
  472.       /** @type {string} */
  473.       elem.style.display = "";
  474.       response.innerHTML = err + ". Send more?";
  475.       /** @type {string} */
  476.       boxChild.style.display = "";
  477.       /** @type {string} */
  478.       digitPar.style.display = "";
  479.       return J = false;
  480.     };
  481.     /** @type {function(): ?} */
  482.     channel.onbufferedamountlow = getInnerText;
  483.     /**
  484.      * @return {?}
  485.      */
  486.     channel.onopen = function() {
  487.       return response.innerHTML = "Waiting for the password...";
  488.     };
  489.     /**
  490.      * @param {!Object} e
  491.      * @return {?}
  492.      */
  493.     channel.onmessage = function(e) {
  494.       var end;
  495.       if (!t) {
  496.         if (data !== e.data) {
  497.           channel.close();
  498.         } else {
  499.           /** @type {boolean} */
  500.           t = true;
  501.           /** @type {string} */
  502.           response.innerHTML = "Sending files...";
  503.           /** @type {string} */
  504.           div.innerHTML = "";
  505.           /** @type {number} */
  506.           var i = 0;
  507.           end = body.length;
  508.           for (; i < end; i++) {
  509.             e = body[i];
  510.             y = y + e.size;
  511.             if (125E6 > e.size) {
  512.               u.push(e);
  513.             } else {
  514.               _sizeAnimateTimeStamps.push(e);
  515.             }
  516.           }
  517.           keys.push("" + y);
  518.           if (0 < u.length) {
  519.             init();
  520.           } else {
  521.             loadFile();
  522.           }
  523.           return setTimeout(function() {
  524.             return getInnerText();
  525.           }, 3E3);
  526.         }
  527.       }
  528.     };
  529.     /** @type {function(): ?} */
  530.     channel.onclose = done;
  531.     /**
  532.      * @param {?} line
  533.      * @return {?}
  534.      */
  535.     channel.onerror = function(line) {
  536.       return console.log(line);
  537.     };
  538.     /**
  539.      * @param {!Object} state
  540.      * @return {?}
  541.      */
  542.     peer.onicecandidate = function(state) {
  543.       return null === state || "complete" === peer.iceGatheringState ? send() : actual = true;
  544.     };
  545.     return peer.createOffer(function(sdp) {
  546.       return peer.setLocalDescription(sdp, function() {
  547.         return setTimeout(send, 3E3);
  548.       }, fail);
  549.     }, fail);
  550.   };
  551.   /**
  552.    * @return {undefined}
  553.    */
  554.   window.auth = function() {
  555.     /** @type {string} */
  556.     title.style.display = "";
  557.     /** @type {string} */
  558.     response.innerHTML = "Verifying password...";
  559.     /** @type {string} */
  560.     div.style.display = "inline-block";
  561.     /** @type {string} */
  562.     div.innerHTML = "";
  563.     /** @type {string} */
  564.     digitPar.innerHTML = "";
  565.     var query = document.getElementById("passwordInput").value;
  566.     /** @type {!XMLHttpRequest} */
  567.     var xhr = new XMLHttpRequest;
  568.     xhr.open("GET", "/link?id=" + window.location.href.substr(window.location.href.lastIndexOf("/") + 1) + "&password=" + query, true);
  569.     xhr.setRequestHeader("Content-Type", "application/json");
  570.     /**
  571.      * @return {?}
  572.      */
  573.     xhr.onload = function() {
  574.       var head;
  575.       if (4 === xhr.readyState) {
  576.         if (401 === xhr.status) {
  577.           /** @type {string} */
  578.           title.style.display = "block";
  579.           /** @type {string} */
  580.           response.innerHTML = "";
  581.           div.innerHTML = xhr.responseText;
  582.         } else {
  583.           if (200 !== xhr.status) {
  584.             response.innerHTML = xhr.responseText;
  585.           } else {
  586.             /** @type {string} */
  587.             response.innerHTML = "Connecting...";
  588.             var peer = new Peer(options);
  589.             /** @type {null} */
  590.             var channel = null;
  591.             /** @type {boolean} */
  592.             var h = head = false;
  593.             /** @type {string} */
  594.             err = "Connection closed";
  595.             /** @type {null} */
  596.             var file = null;
  597.             /** @type {number} */
  598.             var size = 0;
  599.             /** @type {!Array} */
  600.             var parts = [];
  601.             /** @type {number} */
  602.             var b = 1;
  603.             /** @type {number} */
  604.             var count = 0;
  605.             /** @type {boolean} */
  606.             var n = false;
  607.             /** @type {number} */
  608.             var testHtml = 0;
  609.             add();
  610.             /**
  611.              * @param {?} area
  612.              * @return {?}
  613.              */
  614.             var error = function(area) {
  615.               return console.log(area);
  616.             };
  617.             /**
  618.              * @return {?}
  619.              */
  620.             done = function() {
  621.               peer.close();
  622.               response.innerHTML = "" + err;
  623.               div.innerHTML = testHtml + " files received";
  624.               /** @type {string} */
  625.               boxChild.style.display = "";
  626.               /** @type {string} */
  627.               digitPar.style.display = "";
  628.               return J = false;
  629.             };
  630.             /**
  631.              * @return {?}
  632.              */
  633.             var send = function() {
  634.               if (!head && (h || "complete" === peer.iceGatheringState)) {
  635.                 return xhr = new XMLHttpRequest, xhr.open("PUT", "/link?id=" + window.location.href.substr(window.location.href.lastIndexOf("/") + 1) + "&password=" + query, true), xhr.setRequestHeader("Content-Type", "application/json"), xhr.onload = function() {
  636.                   if (4 === xhr.readyState) {
  637.                     if (204 !== xhr.status) {
  638.                       response.innerHTML = xhr.responseText;
  639.                     } else {
  640.                       return response.innerHTML = "Connecting...";
  641.                     }
  642.                   }
  643.                 }, xhr.send(JSON.stringify(peer.localDescription)), head = true;
  644.               }
  645.             };
  646.             /**
  647.              * @param {!Object} event
  648.              * @return {?}
  649.              */
  650.             peer.ondatachannel = function(event) {
  651.               channel = event.channel;
  652.               /**
  653.                * @return {?}
  654.                */
  655.               channel.onopen = function() {
  656.                 /** @type {string} */
  657.                 channel.binaryType = "arraybuffer";
  658.                 channel.send(query);
  659.                 return response.innerHTML = "Receiving files...";
  660.               };
  661.               /**
  662.                * @param {string} e
  663.                * @return {?}
  664.                */
  665.               channel.onmessage = function(e) {
  666.                 if (y) {
  667.                   if (file) {
  668.                     parts.push(e.data);
  669.                     yi = yi + e.data.byteLength;
  670.                     size = size + e.data.byteLength;
  671.                     count = count + e.data.byteLength;
  672.                     if (size === file.size) {
  673.                       /** @type {!Blob} */
  674.                       var blob = new Blob(parts, {
  675.                         type : file.type
  676.                       });
  677.                       var url = window.URL.createObjectURL(blob);
  678.                       download.href = url;
  679.                       /** @type {string} */
  680.                       download.download = 1 === b ? file.name : file.name + ("." + b + ".piece");
  681.                       download.click();
  682.                       setTimeout(function(old_url) {
  683.                         window.URL.revokeObjectURL(old_url);
  684.                         return blob = null;
  685.                       }, 1E3, url);
  686.                       testHtml = testHtml + 1;
  687.                       /** @type {string} */
  688.                       div.innerHTML = testHtml + " files received so far";
  689.                       /** @type {null} */
  690.                       file = null;
  691.                       /** @type {number} */
  692.                       count = size = 0;
  693.                       /** @type {number} */
  694.                       b = 1;
  695.                       /** @type {boolean} */
  696.                       n = false;
  697.                       return parts = [];
  698.                     }
  699.                     if (45E7 < count && (digitPar.innerHTML = "Some files were split since they are too big to be saved in one piece, use the combiner script to combine them back into one file.", blob = new Blob(parts, {
  700.                       type : file.type
  701.                     }), url = window.URL.createObjectURL(blob), download.href = url, e = 10 > b ? "0" + b : b, download.download = file.name + ("." + e + ".piece"), b = b + 1, download.click(), setTimeout(function(old_url) {
  702.                       window.URL.revokeObjectURL(old_url);
  703.                       return blob = null;
  704.                     }, 1E3, url), count = 0, parts = [], !n)) {
  705.                       /** @type {null} */
  706.                       var script = null;
  707.                       /** @type {!Blob} */
  708.                       script = -1 !== window.navigator.userAgent.indexOf("Windows") ? new Blob(["COPY /b " + file.name + "*.piece " + file.name + "\r\nDEL " + file.name + '*.piece\r\nDEL "%~f0"'], {
  709.                         type : "application/bat"
  710.                       }) : new Blob(["#!/bin/sh\ncat " + file.name + "*.piece > " + file.name + "\nrm -f " + file.name + '*.piece\nrm -- "$0"'], {
  711.                         type : "application/x-sh"
  712.                       });
  713.                       e = window.URL.createObjectURL(script);
  714.                       /** @type {string} */
  715.                       r.href = e;
  716.                       /** @type {string} */
  717.                       r.download = file.name + ".combiner." + (-1 !== window.navigator.userAgent.indexOf("Windows") ? "bat" : "sh");
  718.                       r.click();
  719.                       setTimeout(function(old_url) {
  720.                         window.URL.revokeObjectURL(old_url);
  721.                         return script = null;
  722.                       }, 1E3, e);
  723.                       return n = true;
  724.                     }
  725.                   } else {
  726.                     return file = JSON.parse(e.data);
  727.                   }
  728.                 } else {
  729.                   return y = +e.data, boxChild.style.display = "inline-block", digitPar.style.display = "inline-block", div.innerHTML = testHtml + " files received so far", J = true, success();
  730.                 }
  731.               };
  732.               channel.onclose = done;
  733.               return channel.onerror = function(line) {
  734.                 return console.log(line);
  735.               };
  736.             };
  737.             /**
  738.              * @param {!Object} state
  739.              * @return {?}
  740.              */
  741.             peer.onicecandidate = function(state) {
  742.               return null === state || "complete" === peer.iceGatheringState ? send() : h = true;
  743.             };
  744.             return peer.setRemoteDescription(new SessionDescription(JSON.parse(xhr.responseText).offer), function() {
  745.               return peer.createAnswer(function(sdp) {
  746.                 return peer.setLocalDescription(sdp, function() {
  747.                   return setTimeout(send, 3E3);
  748.                 }, error);
  749.               }, error);
  750.             }, error);
  751.           }
  752.         }
  753.       }
  754.     };
  755.     xhr.send();
  756.   };
  757. }).call(this);
  758.  
Advertisement
Add Comment
Please, Sign In to add comment