lib/views/bookmarklet.erb in terminus-0.1.0 vs lib/views/bookmarklet.erb in terminus-0.2.0

- old
+ new

@@ -1,17 +1,22 @@ (function() { var faye = '<%= ::Terminus::FAYE_MOUNT %>', host = '<%= host %>'; + var html = document.getElementsByTagName('html')[0], + source = '<html>\n' + html.innerHTML + '\n</html>\n'; + + JSCLASS_PATH = host + '/js.class/'; + var withPackageManager = function(callback) { if (window.JS && JS.Packages) return callback(); var script = document.createElement('script'), head = document.getElementsByTagName('head')[0]; script.type = 'text/javascript'; - script.src = host + '/js.packages.js'; + script.src = host + '/loader.js'; script.onload = script.onreadystatechange = function() { var state = script.readyState; if (!state || state === 'loaded' || state === 'complete') { script.onload = script.onreadystatechange = null; @@ -23,17 +28,22 @@ }; withPackageManager(function() { JS.Packages(function() { this.file(host + faye + '/client.js') - .provides('Faye', 'Faye.Client'); + .provides('Faye', 'Faye.Client') + .setup(function() { Faye.Client.prototype.MAX_DELAY = 0 }); + this.file(host + '/syn.js') + .provides('Syn'); + this.file(host + '/terminus.js') - .requires('Faye.Client') + .requires('Faye.Client', 'document.evaluate', 'Syn') .provides('Terminus'); }); - require('Terminus', function() { + JS.require('Terminus', function() { + Terminus.originalSource = source; Terminus.connect(host + faye); }); }); })();