]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Include soundmanager2 by default as 95% of hits will include it anyway.
authorChris Porter <redacted>
Sat, 5 Mar 2011 03:42:34 +0000 (03:42 +0000)
committerChris Porter <redacted>
Sat, 5 Mar 2011 03:42:34 +0000 (03:42 +0000)
bin/pages.py
js/qwebircinterface.js
js/sound.js
js/soundmanager_defer.js [new file with mode: 0644]

index 32e9b8786737a416d3b9a3e33df115e727a1f905..f75516d34b8fadce1bf87085e18394b7e3a2a07d 100644 (file)
@@ -6,10 +6,10 @@ UI_BASE.extend(["panes/%s" % x for x in PANES])
 
 DEBUG_BASE = ["qwebirc", "version", "jslib", "crypto", "md5", ["irc/%s" % x for x in IRC_BASE], ["ui/%s" % x for x in UI_BASE], "qwebircinterface", "auth", "sound"]
 BUILD_BASE = ["qwebirc"]
-JS_DEBUG_BASE = ["mootools-1.2.1-core-nc", "mootools-1.2-more-nc"]
+JS_DEBUG_BASE = ["mootools-1.2.1-core-nc", "mootools-1.2-more-nc", "debug/soundmanager_defer", "soundmanager2"]
 JS_RAW_BASE = ["//ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js"]
-JS_BASE = ["mootools-1.2-more"]
-JS_EXTRA = ["soundmanager2"]
+JS_BASE = ["mootools-1.2-more", "../../js/soundmanager_defer", "soundmanager2-nodebug-jsmin"]
+JS_EXTRA = []
 
 UIs = {
   "qui": {
index 5d5035b715d8ae5d09ad0dc83aea309ba327f730..cab0249bfb6b9821361ffc52cb97eb468da4e533 100644 (file)
@@ -33,6 +33,7 @@ qwebirc.ui.Interface = new Class({
     qwebirc.global = {
       dynamicBaseURL: options.dynamicBaseURL,
       staticBaseURL: options.staticBaseURL,
+      baseURL: options.baseURL,
       nicknameValidator: $defined(options.nickValidation) ? new qwebirc.irc.NicknameValidator(options.nickValidation) : new qwebirc.irc.DummyNicknameValidator()
     };
 
index f2043824a0bd760eb7f3abd49fc3ab514ebc3b22..f8822013ea44f832cf2a2e25de2f81a7e518a385 100644 (file)
@@ -8,6 +8,12 @@ qwebirc.sound.SoundPlayer = new Class({
   initialize: function() {
     this.loadingSWF = false;
     this.loadedSWF = false;
+
+    var sb = qwebirc.global.staticBaseURL;
+    if(qwebirc.global.baseURL.substr(qwebirc.global.baseURL.length - 1, 1) == "/" && sb.substr(0, 1) == "/")
+      sb = sb.substr(1)
+
+    this.soundURL = qwebirc.global.baseURL + sb + "sound/";
   },
   go: function() {
     if(qwebirc.sound.domReady) {
@@ -22,24 +28,23 @@ qwebirc.sound.SoundPlayer = new Class({
     if(this.loadingSWF)
       return;
     this.loadingSWF = true;
-    if(eval("typeof soundManager") != "undefined") {
+
+    var debugMode = false;
+
+    window.soundManager = new SoundManager();
+
+    var sb = qwebirc.global.staticBaseURL;
+    if(qwebirc.global.baseURL.substr(-1) == "/" && sb.substr(0, 1) == "/")
+      sb = sb.substr(1)
+    
+    window.soundManager.url = this.soundURL;
+    window.soundManager.debugMode = debugMode;
+    window.soundManager.useConsole = debugMode;
+    window.soundManager.onload = function() {
       this.loadedSWF = true;
       this.fireEvent("ready");
-      return;
-    }
-    
-    var debugMode = false;
-    qwebirc.util.importJS(qwebirc.global.staticBaseURL + "js/" + (debugMode?"soundmanager2":"soundmanager2-nodebug-jsmin") + ".js", "soundManager", function() {
-      soundManager.url = qwebirc.global.staticBaseURL + "sound/";
-      
-      soundManager.debugMode = debugMode;
-      soundManager.useConsole = debugMode;
-      soundManager.onload = function() {
-        this.loadedSWF = true;
-        this.fireEvent("ready");
-      }.bind(this);
-      soundManager.beginDelayedInit();
-    }.bind(this));
+    }.bind(this);
+    window.soundManager.beginDelayedInit();
   },
   createSound: function(name, src) {
     soundManager.createSound(name, src);
@@ -49,7 +54,7 @@ qwebirc.sound.SoundPlayer = new Class({
   },
   beep: function() {
     if(!this.beepLoaded) {
-      this.createSound("beep", qwebirc.global.staticBaseURL + "sound/beep3.mp3");
+      this.createSound("beep", this.soundURL + "beep3.mp3");
       this.beepLoaded = true;
     }
     this.playSound("beep");
diff --git a/js/soundmanager_defer.js b/js/soundmanager_defer.js
new file mode 100644 (file)
index 0000000..5255280
--- /dev/null
@@ -0,0 +1 @@
+window.SM2_DEFER = true;