Commit d1fdb585 authored by Sparkf's avatar Sparkf 🏙️
Browse files
parents 7de42aad 8cf4cf3b
Loading
Loading
Loading
Loading
+54 −3
Original line number Diff line number Diff line
function post_to_wx() {
    var obj = {
        'msgType': "heartbeat",
        'shareTitle': document.title,
        'shareURL': document.URL,
        'scrollTop': document.documentElement.scrollTop,
        'time': (new Date()).valueOf()
    }
    };
    wx.miniProgram.postMessage({
        data: obj
    })
    });
    wx.miniProgram.getEnv(function (res) {
        window.is_miniprogram = res.miniprogram;
    });
}
setInterval(post_to_wx, 1000);

function handleOutURL(url) {
    console.log("劫持链接 " + url);
    wx.miniProgram.navigateTo({
        url: '/pages/index/redirect?outURL=' + encodeURIComponent(url),
    });
}

function override_onclick(event) {
    if (window.is_miniprogram) {
        let url = event.currentTarget.getAttribute('href');

        let domain = new URL(url);
        domain = domain.hostname;
        let whitelist = new Set();
        whitelist.add("mirrors.sustech.edu.cn");
        whitelist.add("bus.sustcra.com");
        whitelist.add("sustech.online");
        if (whitelist.has(domain)) {
            console.log("放行白名单页面 " + url);
            window.location.href = url;
            return;
        }

        event.preventDefault();
        console.log("小程序环境,拦截外部链接。");
        handleOutURL(url);
        // return false;
    }
    // ------------
    // else {
    //     return true;
    // }
}

function reset_all_anchor() {
    var anchors = document.getElementsByTagName('a');
    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        anchor.onclick = function () {
            override_onclick(event);
        }
    }
}

setInterval(reset_all_anchor, 1000);
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
此版本为预先发布,校历随时可能变化。
:::

<iframe src="https://mirrors.sustech.edu.cn/site/sustech-online/pdfjs/web/viewer.html?file=https://cdn.jsdelivr.net/gh/sustc/sustech-online-ng@master/docs/calendar/2021-2022-excel.pdf" style="width: 100%; height: 800px;"></iframe>
<iframe src="https://mirrors.sustech.edu.cn/site/sustech-online/pdfjs/web/viewer.html?file=https://cdn.jsdelivr.net/gh/sustc/sustech-online-ng@master/docs/calendar/2021-2022-excel.pdf" width="100%" height="600" ></iframe>

<a data-fancybox title="" href="https://cdn.jsdelivr.net/gh/sustc/sustech-online-ng@master/docs/calendar/pic/212201.jpg">![](https://cdn.jsdelivr.net/gh/sustc/sustech-online-ng@master/docs/calendar/pic/212201.jpg)</a>

+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@

<a data-fancybox title="" href="https://cdn.jsdelivr.net/gh/sustc/sustech-online-ng@master/docs/calendar/pic/202102.jpg">![](https://cdn.jsdelivr.net/gh/sustc/sustech-online-ng@master/docs/calendar/pic/202102.jpg)</a>

<iframe src="https://mirrors.sustech.edu.cn/site/sustech-online/pdfjs/web/viewer.html?file=https://cdn.jsdelivr.net/gh/sustc/sustech-online-ng@master/docs/calendar/2021-2022-excel.pdf" style="width: 100%; height: 800px;"></iframe>
<iframe src="https://mirrors.sustech.edu.cn/site/sustech-online/pdfjs/web/viewer.html?file=https://cdn.jsdelivr.net/gh/sustc/sustech-online-ng@master/docs/calendar/2021-2022-excel.pdf" width="100%" height="600" ></iframe>

## 历史校历(存档)

+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@

除了常规的自习室与纸质书刊借阅服务外,图书馆还提供其他服务:
### 讨论间
可供小组讨论的隔音空间,一般需要提前预约,预约网址:https://booking.lib.sustech.edu.cn/ClientWeb/xcus/ic2/Default.aspx
可供小组讨论的隔音空间,一般需要提前预约,[预约系统地址(点此)](https://booking.lib.sustech.edu.cn/ClientWeb/xcus/ic2/Default.aspx)

如果有尚未被预约的讨论间,也可以直接使用。