瀏覽代碼

another fix.

Nathaniel van Diepen 11 年之前
父節點
當前提交
3ae4db2555
共有 1 個文件被更改,包括 18 次插入16 次删除
  1. 18 16
      app/www/js/omnomirc.js

+ 18 - 16
app/www/js/omnomirc.js

@@ -528,26 +528,28 @@
 			},
 			start: function(name){
 				if(exists(plugins[name])){
-					var plugin = plugins[name];
+					var plugin = plugins[name],
+						hook = function(){
+							var h = arguments[0],
+								f = arguments[1],
+								fn;
+							if( h == 'start' || h == 'stop'){
+								fn = function(){
+									if(arguments[0] == name){
+										f.apply(this,arguments)
+									}
+								}
+							}else{
+								fn = f;
+							}
+							$o.hook.apply($o,[h,fn]);
+						};
 					if(plugin.started){
 						$o.plugin.stop(name);
 					}
 					event('Starting plugin '+name);
-					pluginSandbox.hook = pluginSandbox.$o.hook = function(){
-						var h = arguments[0],
-							f = arguments[1],
-							fn;
-						if( h == 'start' || h == 'stop'){
-							fn = function(){
-								if(arguments[0] == name){
-									f.apply(this,arguments)
-								}
-							}
-						}else{
-							fn = f;
-						}
-						$o.hook.apply($o,[h,fn]);
-					};
+					pluginSandbox.hook = hook;
+					pluginSandbox.$o.hook = hook;
 					if(!plugin.loaded){
 						$.ajax('data/plugins/'+name+'/script.js',{
 							dataType: 'text',