Sha256: 518784c2fd51bee88f8871fc81b8b09e8922afaf945651d53af3261140476d6a

Contents?: true

Size: 1.47 KB

Versions: 43

Compression:

Stored size: 1.47 KB

Contents

var Ruby = {
  code: function() {
    var scripts = document.getElementsByTagName("script");
    var rubyCode = '';
  
    for (var i = 0; i < scripts.length; i++) {
      var script = scripts[i];
      if ( (script.getAttribute("type") == "text/ruby") || (script.getAttribute("type") == "text/x-ruby") ) {
        rubyCode += script.innerHTML;
      }
    }
    return rubyCode;
  },

  init: function(callback) {
    Ruby.applet();
    Ruby.evalScript(callback);
  },

  evalScript: function(callback) {
    if (document.RubyApplet.evalRuby && document.RubyApplet.hasStarted()) {
      callback(Ruby.eval(Ruby.code()));
    } else {
      setTimeout(function() {
        Ruby.evalScript(callback);
      }, 500);
    }
  },
  
  eval: function(code) {
    return document.RubyApplet.evalRuby(code);
  },

  applet: function() {
  	var applet = document.createElement('applet');
  	// applet.setAttribute("archive", "http://ruby-in-browser.googlecode.com/svn/trunk/lib/jruby.jar,http://ruby-in-browser.googlecode.com/svn/trunk/lib/asm.jar,http://ruby-in-browser.googlecode.com/svn/trunk/lib/backport-util-concurrent.jar");
  	applet.setAttribute("archive", "/java/jruby.jar,/java/bsf.jar");
  	applet.setAttribute("code", "RubyApplet");
	applet.setAttribute("codebase", "http://ruby-in-browser.googlecode.com/svn/trunk/classes");
  	applet.setAttribute("name", "RubyApplet");
  	applet.setAttribute("width", "1");
  	applet.setAttribute("height", "1");
	
    document.body.appendChild(applet);
  }
};

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
backlog-0.37.2 public/javascripts/ruby.js
backlog-0.37.1 public/javascripts/ruby.js
backlog-0.36.2 public/javascripts/ruby.js
backlog-0.16.0 public/javascripts/ruby.js
backlog-0.17.0 public/javascripts/ruby.js
backlog-0.17.1 public/javascripts/ruby.js
backlog-0.17.2 public/javascripts/ruby.js
backlog-0.17.4 public/javascripts/ruby.js
backlog-0.17.3 public/javascripts/ruby.js
backlog-0.17.5 public/javascripts/ruby.js
backlog-0.18.0 public/javascripts/ruby.js
backlog-0.17.6 public/javascripts/ruby.js
backlog-0.19.0 public/javascripts/ruby.js
backlog-0.20.0 public/javascripts/ruby.js
backlog-0.20.1 public/javascripts/ruby.js
backlog-0.21.0 public/javascripts/ruby.js
backlog-0.21.2 public/javascripts/ruby.js
backlog-0.21.1 public/javascripts/ruby.js
backlog-0.21.3 public/javascripts/ruby.js
backlog-0.22.1 public/javascripts/ruby.js