-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Javascript code refactored, using AMD, issue #11
- Loading branch information
1 parent
7bebebb
commit 85a39e7
Showing
8 changed files
with
69 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
# Node and Grunt files | ||
node_modules | ||
|
||
Gruntfile.js | ||
|
||
## Core latex/pdflatex auxiliary files: | ||
*.aux | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/* | ||
* @see https://github.com/martignoni/moodle-tool_moodlebox | ||
* @package tool_moodlebox | ||
* @copyright 2016 onwards Nicolas Martignoni <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
/** | ||
* @module tool_moodlebox/timediff | ||
*/ | ||
define(['core/str', 'core/notification'], function(str, notification) { | ||
|
||
return /** @alias module:tool/moodlebox */ { | ||
/** | ||
* Global init function for this module. | ||
* | ||
* @method init | ||
* @param {Object} servertime The timestamp of current time on the server. | ||
*/ | ||
init: function(servertime) { | ||
var usertime = Math.round(M.pageloadstarttime.getTime() / 1000); | ||
if (Math.abs(usertime - servertime) >= 300) { // time difference greater than 5 minutes | ||
str.get_strings([{'key': 'datetimesetmessage', component: 'tool_moodlebox'},]).done(function(s) { | ||
notification.addNotification({ | ||
message: s[0], | ||
type: 'error' | ||
}); | ||
}).fail(notification.exception); | ||
} | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "moodle-tool_moodlebox", | ||
"devDependencies": { | ||
"grunt": "^1.0.1", | ||
"grunt-contrib-less": "^1.4.1", | ||
"grunt-contrib-uglify": "^2.3.0", | ||
"grunt-contrib-watch": "^1.0.0", | ||
"grunt-eslint": "^19.0.0", | ||
"grunt-load-gruntfile": "0.0.2", | ||
"grunt-stylelint": "^0.7.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters