Browse Source

"use strict";

Nathaniel van Diepen 10 years ago
parent
commit
5463a32b17
2 changed files with 18 additions and 12 deletions
  1. 8 3
      app/OmnomIRC.js
  2. 10 9
      app/www/js/omnomirc.js

+ 8 - 3
app/OmnomIRC.js

@@ -14,7 +14,12 @@ var fs = require('fs'),
 					port: 6379,
 					host: 'localhost'
 				},
-				debug: false
+				debug: false,
+				paths: {
+					www: './www/',
+					api: './api/',
+					plugins: './plugins/'
+				}
 			},
 			i,
 			options;
@@ -121,7 +126,7 @@ if(cluster.isMaster){
 					},
 					filepath = unescape(uri);
 				if(filepath.substr(0,5) == '/api/'){
-					filepath = path.join('./api/',filepath.substr(5));
+					filepath = path.join(options.paths.api,filepath.substr(5));
 					logger.debug('Attempting to run api script '+filepath);
 					if(fs.existsSync(filepath)){
 						fs.readFile(filepath,function(e,data){
@@ -162,7 +167,7 @@ if(cluster.isMaster){
 						res.end('null;');
 					}
 				}else{
-					serveFile(path.join('./www/',filepath),req,res);
+					serveFile(path.join(options.paths.www,filepath),req,res);
 				}
 			}).resume();
 		}).listen(options.port),

+ 10 - 9
app/www/js/omnomirc.js

@@ -18,6 +18,7 @@
 	along with OmnomIRC.  If not, see <http://www.gnu.org/licenses/>.
 */
 (function(window,$,io,undefined){
+	"use strict";
 	var $o = window.OmnomIRC = window.$o = function(){
 			return 'Version: '+version;
 		},
@@ -293,20 +294,20 @@
 				type: 'style',
 				hook: 'load',
 				fn: function(){
-					
+					// STUB
 				}
 			}
 		],
+		currentPlugin = 0,
 		runHook = function(name){
-			var i,hook;
+			var i,hook,sanbox = {
+				// Sandbox
+			};
 			for(i in hooks){
 				hook = hooks[i];
 				if(hook.hook == name){
-					with({
-						// Sandbox
-					}){
-						hook.fn();
-					}
+				
+					(new Function('with(sandbox){hook.fn();}'))();
 				}
 			}
 		},
@@ -337,7 +338,7 @@
 				}).timeago('dispose');
 			}
 		},
-		socket,$i,$s,$h,$cl,$tl,hht;
+		socket,$i,$s,$h,$cl,$c,$tl,hht;
 	$.extend($o,{
 		version: function(){
 			return version;
@@ -989,7 +990,7 @@
 			$o.chat.connect();
 		}
 	});
-	delete window.io;
+	window.io = null;
 })(window,jQuery,io);
 if (!Date.prototype.toISOString) {
     Date.prototype.toISOString = function() {