diff --git a/js/battledata.js b/js/battledata.js
index 9c2e34725..50a8988e1 100644
--- a/js/battledata.js
+++ b/js/battledata.js
@@ -1412,5 +1412,73 @@ var Tools = {
if (!type) return '';
var sanitizedType = type.replace(/\?/g, '%3f');
return '
';
+ },
+
+ /*********************************************************
+ * Replay files
+ *********************************************************/
+
+ // Replay files are .html files that display a replay for a battle.
+
+ // The .html files mainly contain replay log data; the actual replay
+ // player is downloaded online. Also included is a textual log and
+ // some minimal CSS to make it look pretty, for offline viewing.
+
+ // This strategy helps keep the replay file reasonably small; of
+ // the 30 KB or so for a 50-turn battle, around 10 KB is the log
+ // data, and around 20 KB is the textual log.
+
+ // The actual replay player is downloaded from replay-embed.js,
+ // which handles loading all the necessary resources for turning the log
+ // data into a playable replay.
+
+ // Battle log data is stored in and loaded from a
+ // \n';
+ buf += '\n';
+ buf += '
' + battle.logElem.html() + '
\n';
+ buf += '\n';
+ buf += '\n';
+ return buf;
+ },
+
+ createReplayFileHref: function (room) {
+ return 'data:text/plain;base64,' + encodeURIComponent(window.btoa(unescape(encodeURIComponent(Tools.createReplayFile(room)))));
}
};
diff --git a/js/client-battle.js b/js/client-battle.js
index d782da1de..61d3482b2 100644
--- a/js/client-battle.js
+++ b/js/client-battle.js
@@ -710,7 +710,7 @@
filename += '-' + toId(this.battle.p1.name);
filename += '-' + toId(this.battle.p2.name);
- e.currentTarget.href = Storage.createReplayFileHref(this);
+ e.currentTarget.href = Tools.createReplayFileHref(this);
e.currentTarget.download = filename + '.html';
e.stopPropagation();
diff --git a/js/storage.js b/js/storage.js
index 45189c75c..082fb89d1 100644
--- a/js/storage.js
+++ b/js/storage.js
@@ -1180,67 +1180,6 @@ Storage.exportTeam = function (team) {
return text;
};
-/*********************************************************
- * Replay files
- *********************************************************/
-
-// Replay files are .html files that display a replay for a battle.
-
-// The .html files mainly contain replay log data; the actual replay
-// player is downloaded online. Also included is a textual log and
-// some minimal CSS to make it look pretty, for offline viewing.
-
-// This strategy helps keep the replay file reasonably small; of
-// the 30 KB or so for a 50-turn battle, around 10 KB is the log
-// data, and around 20 KB is the textual log.
-
-// The actual replay player is downloaded from replay-embed.js,
-// which handles loading all the necessary resources for turning the log
-// data into a playable replay.
-
-// Battle log data is stored in and loaded from a
-// \n';
- buf += '\n';
- buf += '' + battle.logElem.html() + '
\n';
- buf += '\n';
- buf += '\n';
- return buf;
-};
-
-Storage.createReplayFileHref = function (room) {
- return 'data:text/plain;base64,' + encodeURIComponent(window.btoa(unescape(encodeURIComponent(Storage.createReplayFile(room)))));
-};
-
/*********************************************************
* Node-webkit
*********************************************************/