diff --git a/Layout/default/footer.php b/Layout/default/footer.php
index e18e6fa8b..58916a8d7 100644
--- a/Layout/default/footer.php
+++ b/Layout/default/footer.php
@@ -7,7 +7,7 @@
@@ -36,6 +36,111 @@
$(this).parent('li').toggleClass('open').find('.submenu:first').toggleClass('open');
}
});
+
+ can("Superexpert")): ?>
+ $(".secondO").addClass("pointer");
+
+ var se_to = 0;
+ var se_intv;
+ var se_notf;
+ $(".footer .secondO").click(function() {
+ if(!se_to) {
+ $.post("=self::getUrl("User", "api")?>",{
+ do: "sse"
+ },
+ function(success) {
+ if(!("status" in success)) return;
+ if(success.status == "OK") {
+ if(!("result" in success)) return;
+ if(!("valid_to" in success.result) || !success.result.valid_to) return;
+
+ se_to = success.result.valid_to;
+ addSeMark();
+ se_intv = setInterval(checkSe, 1000);
+ location.reload();
+ }
+ },
+ "json");
+ }
+ });
+
+ function checkSe() {
+ var now = Math.floor(Date.now() / 1000);
+ if(!se_to || se_to < 0) {
+ clearInterval(se_intv);
+ se_to = null;
+ $("#se_notf").remove();
+ removeSeMark();
+ return;
+ }
+ var rest_duration = se_to - now;
+
+ if(rest_duration <= 0) {
+ clearInterval(se_intv);
+ se_to = null;
+ $("#se_notf").remove();
+ removeSeMark();
+ return;
+ }
+
+ if(rest_duration < 60*5) {
+ // show notification
+ if($("#se_notf").length) {
+ $("#se_notf .time").text(rest_duration);
+ } else {
+ var notf_html = $('
');
+ $("body").prepend(notf_html);
+ }
+
+ }
+ }
+
+ function extSe() {
+ console.log("in ese");
+ $.post("=self::getUrl("User", "api")?>", {
+ do: "ese"
+ },
+ function(success) {
+ if(!("result" in success)) return;
+ if(!("valid_to" in success.result) || !success.result.valid_to) return;
+ se_to = success.result.valid_to;
+ },
+ "json"
+ );
+ }
+
+ function endSe() {
+ $.post("=self::getUrl("User", "api")?>", {
+ do: "endse"
+ },
+ function(success) {
+ if(!("result" in success)) return;
+ if(!("valid_to" in success.result)) return;
+ se_to = success.result.valid_to;
+ location.reload();
+ },
+ "json"
+ );
+ }
+
+ function addSeMark() {
+ if(!$("#se-mark").length) {
+ $("#topbar").append('
');
+ }
+ }
+
+ function removeSeMark() {
+ $("#SeMark").remove();
+ }
+
+ superexpertEnabled()): ?>
+ addSeMark();
+ if(!se_intv) {
+ se_to = =$me->flags["superexpert_lock_date"]?>;
+ setInterval(checkSe, 1000);
+ }
+
+