Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit.

  • Loading branch information...
commit fbb7835609a0bc7c00af26bac05a325741153743 0 parents
@fnichol fnichol authored
Showing with 50 additions and 0 deletions.
  1. +19 −0 index.html
  2. +31 −0 js/libs/documentup.js
19 index.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script src="js/libs/documentup.js"></script>
+ <script>
+ DocumentUp.document({
+ repo: "fnichol/chef-rvm",
+ twitter: "fnichol",
+ afterRender: function() {
+ $('#sections a').html(function(index, heading) {
+ return heading.replace(/^&lt;.*\/a&gt; /, '');
+ });
+ }
+ });
+ </script>
+ </head>
+ <body></body>
+</html>
31 js/libs/documentup.js
@@ -0,0 +1,31 @@
+this.DocumentUp = {};
+
+DocumentUp.document = function (opts) {
+ var repo;
+ if ("string" === typeof opts) {
+ repo = opts;
+ opts = null;
+ } else {
+ repo = opts.repo;
+ delete opts.repo;
+ }
+
+ window.callback = function (resp) {
+ if (resp.status === 200) {
+ document.open();
+ document.write(resp.html);
+ document.close();
+ if (opts && opts.afterRender && typeof opts.afterRender === "function")
+ opts.afterRender()
+ }
+ }
+
+ var script = document.createElement('script');
+ script.src = 'http://documentup.com/'+repo
+ if (opts)
+ script.src += "?config="+encodeURIComponent(JSON.stringify(opts))+'&callback=callback';
+ else
+ script.src += "?callback=callback";
+
+ document.getElementsByTagName('head')[0].appendChild(script);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.