Author: jruchaud Date: 2015-05-26 13:46:29 +0000 (Tue, 26 May 2015) New Revision: 1486 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1486 Log: Begin fix module Modified: wit/index.html wit/js/gui.js wit/js/main.js Modified: wit/index.html =================================================================== --- wit/index.html 2015-05-26 13:36:01 UTC (rev 1485) +++ wit/index.html 2015-05-26 13:46:29 UTC (rev 1486) @@ -9,13 +9,10 @@ global.localStorage = window.localStorage; </script> - <!-- For React --> + <script type="text/javascript" src="node_modules/react/dist/react-with-addons.js"></script> <script type="text/javascript" src="build/main.js"></script> - <!-- For Bootstrap --> <link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css"> - - <!-- For Less --> <link rel="stylesheet" type="text/css" href="build/style.css" /> <link rel="stylesheet" type="text/css" href="build/timeline.css" /> <link rel="stylesheet" type="text/css" href="build/userActivity.css" /> Modified: wit/js/gui.js =================================================================== --- wit/js/gui.js 2015-05-26 13:36:01 UTC (rev 1485) +++ wit/js/gui.js 2015-05-26 13:46:29 UTC (rev 1486) @@ -35,3 +35,39 @@ tray = null; } }); + +var popups = []; +var openWindow = function(file) { + var gui = global.window.nwDispatcher.requireNwGui(); + + var current = gui.Window.get(); + current.hide(); + + scope.user.suspendActivityDetection(); + + var window = gui.Window.open(file, { + position: "center", + focus: true, + toolbar: false, + frame: true, + width: 480, + height: 300 + }); + + popups.push(window); + + window.on("close", function() { + this.hide(); // Pretend to be closed already + this.close(true); + + popups.splice(popups.indexOf(window), 1); + + if (!popups.length) { + current.show(); + } + }); +}; + +// Subscriptions to services +scope.timer.subscribeIdle(openWindow.bind(null, "idle.html")); +scope.user.subscribeActivityChange(openWindow.bind(null, "activityChange.html")); Modified: wit/js/main.js =================================================================== --- wit/js/main.js 2015-05-26 13:36:01 UTC (rev 1485) +++ wit/js/main.js 2015-05-26 13:46:29 UTC (rev 1486) @@ -7,62 +7,13 @@ // Alias // Total time during day -global.scope = window.scope = {}; - -// Services // -var sessions = require("./js/services/SessionsService.js"); -scope.sessions = sessions; - -var timer = require("./js/services/TimerService.js"); -scope.timer = timer; - -var user = require("./js/services/UserActivityService.js"); -scope.user = user; - -var config = require("./js/services/ConfigurationService.js"); -scope.config = config; - var noTimer = require("./js/services/NoTimerService.js"); -scope.noTimer = noTimer; noTimer.detect(); // React conf // -var React = require("react"); -var App = require("./build/App.js"); -React.render(<App/>, document.body); +window.onload = function() { + var React = require("react"); + var App = require("./build/App.js"); -var popups = []; -var openWindow = function(file) { - var gui = global.window.nwDispatcher.requireNwGui(); - - var current = gui.Window.get(); - current.hide(); - - scope.user.suspendActivityDetection(); - - var window = gui.Window.open(file, { - position: "center", - focus: true, - toolbar: false, - frame: true, - width: 480, - height: 300 - }); - - popups.push(window); - - window.on("close", function() { - this.hide(); // Pretend to be closed already - this.close(true); - - popups.splice(popups.indexOf(window), 1); - - if (!popups.length) { - current.show(); - } - }); + React.render(<App/>, document.body); }; - -// Subscriptions to services -scope.timer.subscribeIdle(openWindow.bind(null, "idle.html")); -scope.user.subscribeActivityChange(openWindow.bind(null, "activityChange.html"));