frontend: rely on angular base path
This commit is contained in:
parent
a35aa7be70
commit
921644deb4
5 changed files with 32 additions and 32 deletions
|
@ -170,7 +170,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$interval.cancel(refreshSettingsInterval);
|
||||
refreshSettingsInterval = $interval(refreshSettings, Math.floor(Math.random() * 24000) + 32000);
|
||||
|
||||
$http.get("/settings.json").then(function(response) {
|
||||
$http.get("settings.json").then(function(response) {
|
||||
var time = $rootScope.recvTime(response);
|
||||
response.data.start = new Date(response.data.start);
|
||||
response.data.end = new Date(response.data.end);
|
||||
|
@ -197,7 +197,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$interval.cancel(refreshThemesInterval);
|
||||
refreshThemesInterval = $interval(refreshThemes, Math.floor(Math.random() * 24000) + 32000);
|
||||
|
||||
$http.get("/themes.json").then(function(response) {
|
||||
$http.get("themes.json").then(function(response) {
|
||||
$scope.themes = response.data;
|
||||
$scope.max_gain = 0;
|
||||
$scope.max_solved = 0;
|
||||
|
@ -228,7 +228,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$interval.cancel(refreshTeamsInterval);
|
||||
refreshTeamsInterval = $interval($rootScope.refreshTeams, Math.floor(Math.random() * 24000) + 32000);
|
||||
|
||||
$http.get("/teams.json").then(function(response) {
|
||||
$http.get("teams.json").then(function(response) {
|
||||
var teams = response.data;
|
||||
$scope.teams_count = Object.keys(teams).length
|
||||
$scope.teams = teams;
|
||||
|
@ -260,7 +260,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
return;
|
||||
}
|
||||
|
||||
$http.get("/events.json").then(function(response) {
|
||||
$http.get("events.json").then(function(response) {
|
||||
if (eventsLastRefresh != undefined && eventsLastRefresh == response.headers()["last-modified"])
|
||||
return;
|
||||
eventsLastRefresh = response.headers()["last-modified"];
|
||||
|
@ -301,7 +301,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
if ((kind & $rootScope.notify_field) == kind) {
|
||||
var notification = new Notification("Challenge forensic", {body: event.txt.replace(/&#(\d+);/g, function(match, dec) {return String.fromCharCode(dec);}).replace(/(<([^>]+)>)/ig,""), badge: "/img/icon-" + event.kind + ".ico", icon: "/img/icon-" + event.kind + ".ico"});
|
||||
notification.onclick = function(ev) {
|
||||
$location.url("/edit");
|
||||
$location.url("edit");
|
||||
};
|
||||
setTimeout(notification.close.bind(notification), 4000);
|
||||
}
|
||||
|
@ -318,11 +318,11 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$interval.cancel(refreshMyInterval);
|
||||
refreshMyInterval = $interval(refreshMy, Math.floor(Math.random() * 24000) + 24000);
|
||||
|
||||
$http.get("/my.json").then(function(response) {
|
||||
$http.get("my.json").then(function(response) {
|
||||
$rootScope.recvMy(response.data);
|
||||
}, function(response) {
|
||||
if (!$scope.my && response.status == 404) {
|
||||
$location.url("/register");
|
||||
$location.url("register");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -458,9 +458,9 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$scope.hsubmit = function(hint) {
|
||||
hint.submitted = true;
|
||||
$scope.hinterror = null;
|
||||
$http({ url: "/openhint/" + $rootScope.current_exercice, method: "POST", data: { id: hint.id } }).then(function(response) {
|
||||
$http({ url: "openhint/" + $rootScope.current_exercice, method: "POST", data: { id: hint.id } }).then(function(response) {
|
||||
var checkDiffHint = function() {
|
||||
$http.get("/my.json").then(function(response) {
|
||||
$http.get("my.json").then(function(response) {
|
||||
var my = response.data;
|
||||
angular.forEach(my.exercices[$rootScope.current_exercice].hints, function(h,hid){
|
||||
if (hint.id == h.id) {
|
||||
|
@ -554,7 +554,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
return;
|
||||
}
|
||||
|
||||
$http({ url: "/submit/" + $rootScope.current_exercice, method: "POST", data: resp }).then(function(response) {
|
||||
$http({ url: "submit/" + $rootScope.current_exercice, method: "POST", data: resp }).then(function(response) {
|
||||
$scope.messageClass = {"text-success": true};
|
||||
$scope.message = response.data.errmsg;
|
||||
$scope.sberr = null;
|
||||
|
@ -564,7 +564,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
});
|
||||
|
||||
var checkDiff = function() {
|
||||
$http.get("/my.json").then(function(response) {
|
||||
$http.get("my.json").then(function(response) {
|
||||
var my = response.data;
|
||||
if ($scope.my.exercices[$rootScope.current_exercice].tries != my.exercices[$rootScope.current_exercice].tries || $scope.my.exercices[$rootScope.current_exercice].solved_time != my.exercices[$rootScope.current_exercice].solved_time) {
|
||||
$scope.my.exercices[$rootScope.current_exercice].submitted = false;
|
||||
|
@ -592,9 +592,9 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
|
||||
$scope.wantchoices = function(kid) {
|
||||
$scope.my.exercices[$rootScope.current_exercice].flags[kid].wcsubmitted = true;
|
||||
$http({ url: "/wantchoices/" + $rootScope.current_exercice, method: "POST", data: { id: Math.floor(kid) } }).then(function(response) {
|
||||
$http({ url: "wantchoices/" + $rootScope.current_exercice, method: "POST", data: { id: Math.floor(kid) } }).then(function(response) {
|
||||
var checkDiffWC = function() {
|
||||
$http.get("/my.json").then(function(response) {
|
||||
$http.get("my.json").then(function(response) {
|
||||
var my = response.data;
|
||||
if (my.exercices[$rootScope.current_exercice].flags[kid].choices)
|
||||
$rootScope.recvMy(my);
|
||||
|
@ -650,7 +650,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
localStorage.notification = $rootScope.notify_field;
|
||||
else
|
||||
delete localStorage.notification;
|
||||
$location.url("/");
|
||||
$location.url(".");
|
||||
}
|
||||
|
||||
var cbt;
|
||||
|
@ -674,7 +674,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
}
|
||||
|
||||
$http({
|
||||
url: "/submit/name",
|
||||
url: "submit/name",
|
||||
method: "POST",
|
||||
data: {newName: $scope.my.newName}
|
||||
}).then(function(response) {
|
||||
|
@ -682,7 +682,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$rootScope.message = response.data.errmsg;
|
||||
|
||||
var checkDiff = function() {
|
||||
$http.get("/my.json").then(function(response) {
|
||||
$http.get("my.json").then(function(response) {
|
||||
if ($scope.my.name != response.data.name) {
|
||||
$scope.my.newName = undefined;
|
||||
$rootScope.message = "";
|
||||
|
@ -749,7 +749,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
}
|
||||
|
||||
$http({
|
||||
url: "/registration",
|
||||
url: "registration",
|
||||
method: "POST",
|
||||
data: $scope.form
|
||||
}).then(function(response) {
|
||||
|
@ -757,7 +757,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$scope.message = response.data.errmsg;
|
||||
|
||||
$interval(function(){
|
||||
$http.get("/my.json").then(function(response) {
|
||||
$http.get("my.json").then(function(response) {
|
||||
$rootScope.refresh();
|
||||
});
|
||||
}, 1500);
|
||||
|
@ -773,7 +773,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
|
||||
$scope.$watch("my", function(my){
|
||||
if (my)
|
||||
$location.url("/");
|
||||
$location.url(".");
|
||||
});
|
||||
})
|
||||
.controller("TagController", function($scope, $rootScope, $routeParams, $location) {
|
||||
|
@ -797,7 +797,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
})
|
||||
|
||||
$scope.goDefi = function() {
|
||||
$location.url("/" + this.ex.theme.urlid + "/" + this.ex.exercice.urlid);
|
||||
$location.url(this.ex.theme.urlid + "/" + this.ex.exercice.urlid);
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -835,7 +835,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$rootScope.authors = "";
|
||||
|
||||
$scope.goTheme = function() {
|
||||
$location.url("/" + this.theme.urlid);
|
||||
$location.url(this.theme.urlid);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Reference in a new issue