Permalink
Browse files

Updated index (removed oldindex)

  • Loading branch information...
1 parent fe9b47e commit 1ed5c8e0b89775d9f95cc805941d635b1963140d @blaines committed Jul 13, 2010
Showing with 47 additions and 0 deletions.
  1. +47 −0 load.js
View
47 load.js
@@ -0,0 +1,47 @@
+// Copyright (c) 2008, 2009 Andrew Cantino
+// Copyright (c) 2008, 2009 Kyle Maxwell
+
+function importJS(src, look_for, onload) {
+ var s = document.createElement('script');
+ s.setAttribute('type', 'text/javascript');
+ s.setAttribute('src', src);
+ if (onload) wait_for_script_load(look_for, onload);
+ var head = document.getElementsByTagName('head')[0];
+ if (head) {
+ head.appendChild(s);
+ } else {
+ document.body.appendChild(s);
+ }
+}
+
+function importCSS(href, look_for, onload) {
+ var s = document.createElement('link');
+ s.setAttribute('rel', 'stylesheet');
+ s.setAttribute('type', 'text/css');
+ s.setAttribute('media', 'screen');
+ s.setAttribute('href', href);
+ if (onload) wait_for_script_load(look_for, onload);
+ var head = document.getElementsByTagName('head')[0];
+ if (head) {
+ head.appendChild(s);
+ } else {
+ document.body.appendChild(s);
+ }
+}
+
+function wait_for_script_load(look_for, callback) {
+ var interval = setInterval(function() {
+ if (eval("typeof " + look_for) != 'undefined') {
+ clearInterval(interval);
+ callback();
+ }
+ }, 50);
+}
+
+(function(){
+ importCSS('http://chatlet.heroku.com/chatlet.css');
+ importJS('http://code.jquery.com/jquery-latest.min.js', 'jQuery', function() { // Load everything else when it is done.
+ jQuery.noConflict();
+ importJS('http://chatlet.heroku.com/client.js');
+ });
+})();

0 comments on commit 1ed5c8e

Please sign in to comment.