Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the latest msgpack-javascript on CDN (unpkg.com) #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
<script src="js/prettify/run_prettify.js"></script>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/jquery.leanModal.min.js" ></script>
<script src="js/msgpack.js" ></script>

<script crossorigin src="https://unpkg.com/@msgpack/msgpack"></script>
<style>
<%= t 'css' %>
</style>
Expand Down Expand Up @@ -63,7 +62,7 @@
} catch (e) {
return;
}
var msg = msgpack.pack(obj);
var msg = MessagePack.encode(obj);
var hex = jQuery.map(msg, function(e,i) {
return ("0" + e.toString(16)).slice(-2);
}).join(" ");
Expand All @@ -80,7 +79,7 @@
msgbytes.push(parseInt(hex.substr(i, 2), 16));
}
var msg = String.fromCharCode.apply(String, msgbytes);
var obj=msgpack.unpack(msg);
var obj=MessagePack.decode(msg);
var text=JSON.stringify(obj);
$("#json-text").text(text);
var textLength = encodeURIComponent(text).replace(/%../g,"%").length;
Expand Down
Loading