r1802 - in oipf/emulator/js: . directives
Author: ygrego Date: 2015-07-10 18:37:55 +0200 (Fri, 10 Jul 2015) New Revision: 1802 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1802 Log: Do a progress bar for programme in emulator. Added: oipf/emulator/js/directives/ oipf/emulator/js/directives/ProgrammeProgress.js Added: oipf/emulator/js/directives/ProgrammeProgress.js =================================================================== --- oipf/emulator/js/directives/ProgrammeProgress.js (rev 0) +++ oipf/emulator/js/directives/ProgrammeProgress.js 2015-07-10 16:37:55 UTC (rev 1802) @@ -0,0 +1,38 @@ +Directives.directive("programmeProgress", ["$interval", function($interval) { + + function link(scope, element, attrs) { + var timeoutId; +// var increment = 1000 * 100 / scope.duration; + + //FIX-ME: Add a block for programmes already started + function updateProgrammeProgress() { + /*if (element.width == 100) { + + } + element.width += increment + "%";*/ + console.log("WIDTH", element, element.css("width")); + $interval.cancel(timeoutId); + } + + scope.$watch(attrs.programmeProgress, function(value) { + element.animate({ + width: "+=50px" + }); + updateProgrammeProgress(); + }); + + element.on("$destroy", function() { + $interval.cancel(timeoutId); + }); + + /*// start the UI update process; save the timeoutId for canceling + timeoutId = $interval(function() { + updateProgrammeProgress(); // update DOM + }, 1000);*/ + } + + return { + link: link + }; + +}]);
participants (1)
-
ygregoï¼ users.nuiton.org