Skip to content

Commit

Permalink
IISNode support added
Browse files Browse the repository at this point in the history
  • Loading branch information
Nisheeth Kashyap committed Jun 20, 2013
1 parent ae3e952 commit 16919ec
Show file tree
Hide file tree
Showing 21 changed files with 380 additions and 323 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea /.idea
/console.io.iml /console.io.iml
/node_modules /node_modules
/iisnode
30 changes: 23 additions & 7 deletions addons/inject.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ window.InjectIO = (function () {
// get test info // get test info
for (; !!(script = scripts[i++]);) { for (; !!(script = scripts[i++]);) {
//TODO script.getAttribute possibility can be removed //TODO script.getAttribute possibility can be removed
src = (script.src ? script.src : script.getAttribute('src')).toLowerCase(); src = (script.src ? script.src : (script.getAttribute('src') || '')).toLowerCase();


if (src.indexOf('inject.js') === -1) { if (src.indexOf('inject.js') === -1) {
continue; continue;
Expand All @@ -78,6 +78,10 @@ window.InjectIO = (function () {
params.url = (params.secure ? 'https://' : 'http://') + url.match(re)[1].toString(); params.url = (params.secure ? 'https://' : 'http://') + url.match(re)[1].toString();
} }


if (!params.base) {
params.base = src.indexOf('/console.io/') > -1 ? 'console.io/' : '';
}

break; break;
} }


Expand Down Expand Up @@ -340,6 +344,10 @@ window.InjectIO = (function () {
} }
} }


function getUrl(config){
return config.url + (config.base ? '/' + config.base : '/');
}

// Load required Scripts // Load required Scripts
ready(function init() { ready(function init() {
if (domReady) { if (domReady) {
Expand All @@ -351,15 +359,22 @@ window.InjectIO = (function () {
config = typeof window.ConfigIO !== 'undefined' ? window.ConfigIO : getServerParams(); config = typeof window.ConfigIO !== 'undefined' ? window.ConfigIO : getServerParams();


// fix the ordering for Opera // fix the ordering for Opera
scripts.push(config.url + "/socket.io/socket.io.js"); if(!window.io){
scripts.push(getUrl(config) + "socket.io/socket.io.js");
}


// fix the samsung to load all script up front // fix the samsung to load all script up front
scripts.push(config.url + "/addons/console.io.js"); if(!window.ConsoleIO){
scripts.push(config.url + "/addons/socket.js"); scripts.push(getUrl(config) + "addons/console.io.js");
}

if(!window.SocketIO){
scripts.push(getUrl(config) + "addons/socket.js");
}


if (config.web) { if (config.web && !window.WebIO) {
scripts.push(config.url + "/addons/web.js"); scripts.push(getUrl(config) + "addons/web.js");
requireStyle(config.url + "/resources/console.css"); requireStyle(getUrl(config) + "resources/console.css");
} }


//Request console.io.js file to get connect.sid cookie from the server //Request console.io.js file to get connect.sid cookie from the server
Expand All @@ -376,6 +391,7 @@ window.InjectIO = (function () {
window.onerror = onErrorFn; window.onerror = onErrorFn;


return { return {
getUrl: getUrl,
debug: debug, debug: debug,
require: require, require: require,
ready: ready ready: ready
Expand Down
15 changes: 9 additions & 6 deletions addons/socket.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ window.SocketIO = (function () {


init: function init(config) { init: function init(config) {
this.config = config; this.config = config;
this.io = window.io.connect(config.url, { secure: (typeof config.secure === 'boolean' ? config.secure : config.secure == 'true') }); this.io = window.io.connect(config.url, {
secure: (typeof config.secure === 'boolean' ? config.secure : config.secure == 'true'),
resource: config.base + 'socket.io'
});


// set console.io event // set console.io event
ConsoleIO.on('console', function (data) { ConsoleIO.on('console', function (data) {
Expand Down Expand Up @@ -94,7 +97,7 @@ window.SocketIO = (function () {
this.setInterval = window.setInterval(function () { this.setInterval = window.setInterval(function () {
if (!Socket.io.socket.connected || (Socket.io.socket.connected && !Socket.subscribed)) { if (!Socket.io.socket.connected || (Socket.io.socket.connected && !Socket.subscribed)) {
console.log('forceReconnect reconnecting', Socket.name); console.log('forceReconnect reconnecting', Socket.name);
Socket.io.socket.disconnect(); Socket.io.socket.disconnectSync();
Socket.io.socket.reconnect(); Socket.io.socket.reconnect();
window.clearInterval(Socket.setInterval); window.clearInterval(Socket.setInterval);
Socket.setInterval = null; Socket.setInterval = null;
Expand Down Expand Up @@ -273,8 +276,8 @@ window.SocketIO = (function () {
onPlugin: function onPlugin(data) { onPlugin: function onPlugin(data) {
if (data.WebIO) { if (data.WebIO) {
if (!window.WebIO && data.WebIO.enabled) { if (!window.WebIO && data.WebIO.enabled) {
ConsoleIO.requireStyle(Socket.config.url + "/resources/console.css"); ConsoleIO.requireStyle(InjectIO.getUrl(Socket.config) + "resources/console.css");
ConsoleIO.requireScript(Socket.config.url + "/addons/web.js", function () { ConsoleIO.requireScript(InjectIO.getUrl(Socket.config) + "addons/web.js", function () {
var config = ConsoleIO.extend({}, Socket.config); var config = ConsoleIO.extend({}, Socket.config);
window.WebIO.init(ConsoleIO.extend(config, data.WebIO)); window.WebIO.init(ConsoleIO.extend(config, data.WebIO));
}); });
Expand Down Expand Up @@ -324,7 +327,7 @@ window.SocketIO = (function () {


onCaptureScreen: function onCaptureScreen() { onCaptureScreen: function onCaptureScreen() {
addFunctionBindSupport(); addFunctionBindSupport();
window.ConsoleIO.requireScript(Socket.config.url + "/addons/html2canvas.js", function () { window.ConsoleIO.requireScript(InjectIO.getUrl(Socket.config) + "addons/html2canvas.js", function () {
var parentNode, var parentNode,
webLog = document.getElementById('console-log'); webLog = document.getElementById('console-log');


Expand All @@ -337,7 +340,7 @@ window.SocketIO = (function () {
completed: false, completed: false,
logging: true, logging: true,
useCORS: true, useCORS: true,
proxy: Socket.config.url + '/proxy', proxy: InjectIO.getUrl(Socket.config) + 'proxy',
onrendered: function (canvas) { onrendered: function (canvas) {
if (!this.completed) { if (!this.completed) {
try { try {
Expand Down
99 changes: 99 additions & 0 deletions app/constant.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* Created with JetBrains WebStorm.
* User: nisheeth
* Date: 18/06/13
* Time: 12:31
* To change this template use File | Settings | File Templates.
*/

ConsoleIO.namespace("ConsoleIO.Constant.THEMES");
ConsoleIO.namespace("ConsoleIO.Constant.IMAGE_URL");
ConsoleIO.namespace("ConsoleIO.Constant.ICONS");

ConsoleIO.Constant.THEMES = {
'web': {
layout: 'dhx_skyblue',
grid: 'dhx_skyblue',
win: 'dhx_skyblue'
},
'terrace': {
layout: 'dhx_terrace',
grid: 'dhx_terrace',
win: 'dhx_terrace'
},
get: function get(type) {
return ConsoleIO.Constant.THEMES[ConsoleIO.Settings.theme][type];
}
};

ConsoleIO.Constant.IMAGE_URL = {
'web': {
tree: "lib/dhtmlx/web/imgs/csh_vista/",
tab: "lib/dhtmlx/web/imgs/",
win: "lib/dhtmlx/web/imgs/",
grid: "lib/dhtmlx/web/imgs/"
},
'terrace': {
tree: "lib/dhtmlx/terrace/imgs/csh_dhx_terrace/",
tab: "lib/dhtmlx/terrace/imgs/",
win: "lib/dhtmlx/terrace/imgs/",
grid: "lib/dhtmlx/terrace/imgs/"
},
get: function get(type) {
return ConsoleIO.Constant.IMAGE_URL[ConsoleIO.Settings.theme][type];
}
};

ConsoleIO.Constant.ICONS = {
ONLINE: 'online.png',
OFFLINE: 'offline.png',
SUBSCRIBE: 'subscribe.gif',
VERSION: 'version.gif',

//Platform icons
PC: 'pc.png',
TV: 'tv.jpg',
STB: 'stb.png',
MOBILE: 'mobile.png',
TABLET: 'tablet.png',
MEDIA: 'media.png',
BLUERAY: 'blueray.png',
CONSOLE: 'playstation.png',

//Manufacturers icons
LG: 'lg.png',
PHILIPS: 'philips.jpg',
SAMSUNG: 'samsung.jpg',
TOSHIBA: 'toshiba.png',
TESCO: 'tesco.jpg',
SONY: 'sony.jpg',
MICROSOFT: 'microsoft.png',
MOZILLA: 'mozilla.png',
GOOGLE: 'google.png',
APPLE: 'apple.png',
ANDROID: 'android.png',
"OPERA SOFTWARE": 'opera.png',

//Browser icons
GINGERBREAD: 'gingerbread.jpg',
CHROME: 'chrome.png',
IE: 'explorer.png',
FIREFOX: 'firefox.png',
OPERA: 'opera.png',
SAFARI: 'safari.png',
MAPLE: 'maple.gif',
NETTV: 'nettv.png',
NETCAST: 'netcast.gif',
TOSHIBATP: 'toshibatp.png',
ESPIAL: 'espial.png',
MSTAR: 'mstar.png',
//"OREGAN MEDIA": '',
PLAYSTATION: 'playstation.png',

JAVASCRIPT: 'javascript.gif',
STYLESHEET: 'stylesheet.gif',
WEB: 'web.png',
FILE: '',
UNKNOWN: 'unknown.png',
FOLDEROPEN: '../../' + ConsoleIO.Constant.IMAGE_URL.get('tree') + '/folderOpen.gif'
};
14 changes: 7 additions & 7 deletions app/controller/browser.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ ConsoleIO.App.Browser.prototype.online = function online(data) {
if (this.isSubscribed(data.guid)) { if (this.isSubscribed(data.guid)) {
this.subscribed(data); this.subscribed(data);
} else { } else {
this.view.setIcon(data.guid, ConsoleIO.Constraint.ICONS.ONLINE); this.view.setIcon(data.guid, ConsoleIO.Constant.ICONS.ONLINE);
} }
}; };


ConsoleIO.App.Browser.prototype.offline = function offline(data) { ConsoleIO.App.Browser.prototype.offline = function offline(data) {
if (this.store.offline.indexOf(data.guid) === -1) { if (this.store.offline.indexOf(data.guid) === -1) {
this.store.offline.push(data.guid); this.store.offline.push(data.guid);
} }
this.view.setIcon(data.guid, ConsoleIO.Constraint.ICONS.OFFLINE); this.view.setIcon(data.guid, ConsoleIO.Constant.ICONS.OFFLINE);
}; };


ConsoleIO.App.Browser.prototype.isSubscribed = function isSubscribed(guid) { ConsoleIO.App.Browser.prototype.isSubscribed = function isSubscribed(guid) {
Expand All @@ -59,7 +59,7 @@ ConsoleIO.App.Browser.prototype.subscribed = function subscribed(data) {
if (!this.isSubscribed(data.guid)) { if (!this.isSubscribed(data.guid)) {
this.store.subscribed.push(data.guid); this.store.subscribed.push(data.guid);
} }
this.view.setIcon(data.guid, ConsoleIO.Constraint.ICONS.SUBSCRIBE); this.view.setIcon(data.guid, ConsoleIO.Constant.ICONS.SUBSCRIBE);
}; };


ConsoleIO.App.Browser.prototype.unSubscribed = function unSubscribed(data) { ConsoleIO.App.Browser.prototype.unSubscribed = function unSubscribed(data) {
Expand All @@ -81,22 +81,22 @@ ConsoleIO.App.Browser.prototype.add = function add(data) {


if (this.store.platform.indexOf(data.platform) === -1) { if (this.store.platform.indexOf(data.platform) === -1) {
this.store.platform.push(data.platform); this.store.platform.push(data.platform);
this.view.add(data.platform, data.platform, 0, ConsoleIO.Constraint.ICONS[data.platform.toUpperCase()] || ConsoleIO.Constraint.ICONS.UNKNOWN); this.view.add(data.platform, data.platform, 0, ConsoleIO.Constant.ICONS[data.platform.toUpperCase()] || ConsoleIO.Constant.ICONS.UNKNOWN);
} }


if (this.store.manufacture.indexOf(manufacture) === -1) { if (this.store.manufacture.indexOf(manufacture) === -1) {
this.store.manufacture.push(manufacture); this.store.manufacture.push(manufacture);
this.view.add(manufacture, data.manufacture, data.platform, ConsoleIO.Constraint.ICONS[data.manufacture.toUpperCase()] || ConsoleIO.Constraint.ICONS.UNKNOWN); this.view.add(manufacture, data.manufacture, data.platform, ConsoleIO.Constant.ICONS[data.manufacture.toUpperCase()] || ConsoleIO.Constant.ICONS.UNKNOWN);
} }


if (this.store.browser.indexOf(browser) === -1) { if (this.store.browser.indexOf(browser) === -1) {
this.store.browser.push(browser); this.store.browser.push(browser);
this.view.add(browser, data.browser, manufacture, ConsoleIO.Constraint.ICONS[data.browser.toUpperCase()] || ConsoleIO.Constraint.ICONS.UNKNOWN); this.view.add(browser, data.browser, manufacture, ConsoleIO.Constant.ICONS[data.browser.toUpperCase()] || ConsoleIO.Constant.ICONS.UNKNOWN);
} }


if (this.store.version.indexOf(version) === -1) { if (this.store.version.indexOf(version) === -1) {
this.store.version.push(version); this.store.version.push(version);
this.view.add(version, data.version, browser, ConsoleIO.Constraint.ICONS.VERSION); this.view.add(version, data.version, browser, ConsoleIO.Constant.ICONS.VERSION);
} }


this.view.addOrUpdate(data.guid, data.name.indexOf('|') > -1 ? data.browser : data.name, version); this.view.addOrUpdate(data.guid, data.name.indexOf('|') > -1 ? data.browser : data.name, version);
Expand Down
4 changes: 2 additions & 2 deletions app/controller/device/explorer.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ ConsoleIO.App.Device.Explorer.prototype.add = function add(data) {
if (isJSFile || isCSSFile) { if (isJSFile || isCSSFile) {
if (this.store.files.indexOf(id) === -1) { if (this.store.files.indexOf(id) === -1) {
this.store.files.push(id); this.store.files.push(id);
this.view.add(id, name, parentId, ConsoleIO.Constraint.ICONS[isJSFile ? 'JAVASCRIPT' : isCSSFile ? 'STYLESHEET' : 'FILE']); this.view.add(id, name, parentId, ConsoleIO.Constant.ICONS[isJSFile ? 'JAVASCRIPT' : isCSSFile ? 'STYLESHEET' : 'FILE']);
} }
} else { } else {
if (this.store.folder.indexOf(id) === -1) { if (this.store.folder.indexOf(id) === -1) {
this.store.folder.push(id); this.store.folder.push(id);


this.view.add(id, name, parentId, ConsoleIO.Constraint.ICONS[isHttpFile ? 'WEB' : 'FOLDEROPEN']); this.view.add(id, name, parentId, ConsoleIO.Constant.ICONS[isHttpFile ? 'WEB' : 'FOLDEROPEN']);
} }
} }
}, this); }, this);
Expand Down
44 changes: 18 additions & 26 deletions app/index.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>Console.IO</title> <title>Console.IO</title>
<script type="text/javascript" src="/socket.io/socket.io.js"></script> <script type="text/javascript" src="socket.io/socket.io.js"></script>


<!--<link rel="stylesheet" href="lib/dhtmlx/terrace/dhtmlx.css">--> <!--<link rel="stylesheet" href="lib/dhtmlx/terrace/dhtmlx.css">-->
<link rel="stylesheet" type="text/css" href="lib/dhtmlx/web/dhtmlx.css"> <link rel="stylesheet" type="text/css" href="lib/dhtmlx/web/dhtmlx.css">
Expand Down Expand Up @@ -39,47 +39,39 @@
<script type="text/javascript" src="lib/codemirror/addon/selection/active-line.js"></script> <script type="text/javascript" src="lib/codemirror/addon/selection/active-line.js"></script>
<script type="text/javascript" src="lib/codemirror/addon/display/placeholder.js"></script> <script type="text/javascript" src="lib/codemirror/addon/display/placeholder.js"></script>


<script type="text/javascript" src="service/utils.js"></script>
<script type="text/javascript" src="start.js"></script>

<script type="text/javascript" src="settings.js"></script>
<script type="text/javascript" src="constant.js"></script>
<script type="text/javascript" src="model/dhtmlx.js"></script>


<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="service/socket.js"></script> <script type="text/javascript" src="service/socket.js"></script>
<script type="text/javascript" src="service/dhtmlxHelper.js"></script> <script type="text/javascript" src="service/dhtmlxHelper.js"></script>
<script type="text/javascript" src="model/dhtmlx.js"></script>


<script type="text/javascript" src="controller/app.js"></script> <script type="text/javascript" src="controller/app.js"></script>
<script type="text/javascript" src="view/app.js"></script>

<script type="text/javascript" src="controller/browser.js"></script> <script type="text/javascript" src="controller/browser.js"></script>
<script type="text/javascript" src="view/browser.js"></script>

<script type="text/javascript" src="controller/editor.js"></script> <script type="text/javascript" src="controller/editor.js"></script>
<script type="text/javascript" src="view/editor.js"></script>

<script type="text/javascript" src="controller/manager.js"></script> <script type="text/javascript" src="controller/manager.js"></script>
<script type="text/javascript" src="view/manager.js"></script>

<script type="text/javascript" src="controller/device/device.js"></script> <script type="text/javascript" src="controller/device/device.js"></script>
<script type="text/javascript" src="view/device/device.js"></script>

<script type="text/javascript" src="controller/device/panel.js"></script> <script type="text/javascript" src="controller/device/panel.js"></script>
<script type="text/javascript" src="view/device/panel.js"></script>

<script type="text/javascript" src="controller/device/explorer.js"></script> <script type="text/javascript" src="controller/device/explorer.js"></script>
<script type="text/javascript" src="view/device/explorer.js"></script>

<script type="text/javascript" src="controller/device/console.js"></script> <script type="text/javascript" src="controller/device/console.js"></script>
<script type="text/javascript" src="view/device/console.js"></script>

<script type="text/javascript" src="controller/device/source.js"></script> <script type="text/javascript" src="controller/device/source.js"></script>
<script type="text/javascript" src="view/device/source.js"></script>

<script type="text/javascript" src="controller/device/preview.js"></script> <script type="text/javascript" src="controller/device/preview.js"></script>
<script type="text/javascript" src="view/device/preview.js"></script>

<script type="text/javascript" src="controller/device/status.js"></script> <script type="text/javascript" src="controller/device/status.js"></script>
<script type="text/javascript" src="view/device/status.js"></script>

<!--<script type="text/javascript" src="view/view.js"></script>-->


<script type="text/javascript" src="view/app.js"></script>
<script type="text/javascript" src="view/browser.js"></script>
<script type="text/javascript" src="view/editor.js"></script>
<script type="text/javascript" src="view/manager.js"></script>
<script type="text/javascript" src="view/device/device.js"></script>
<script type="text/javascript" src="view/device/panel.js"></script>
<script type="text/javascript" src="view/device/explorer.js"></script>
<script type="text/javascript" src="view/device/console.js"></script>
<script type="text/javascript" src="view/device/source.js"></script>
<script type="text/javascript" src="view/device/preview.js"></script>
<script type="text/javascript" src="view/device/status.js"></script>
</head> </head>
<body> <body>
</body> </body>
Expand Down
Loading

0 comments on commit 16919ec

Please sign in to comment.