1.1稳定版后台页js报错

讨论程序使用中的问题
回复
huelse
帖子: 1
注册时间: 2019年 9月 9日 20:55

1.1稳定版后台页js报错

帖子 huelse »

我最近新安装了一个稳定版的typecho,发现在后台首页的更新js在console中发出报错,具体来自于available为null导致的

图片

来源于这段JS

代码: 全选

$(document).ready(function () {
    var ul = $('#typecho-message ul'), cache = window.sessionStorage,
        html = cache ? cache.getItem('feed') : '',
        update = cache ? cache.getItem('update') : '';

    if (!!html) {
        ul.html(html);
    } else {
        html = '';
        $.get('https://uioi.cn/index.php/action/ajax?do=feed', function (o) {
            for (var i = 0; i < o.length; i ++) {
                var item = o[i];
                html += '<li><span>' + item.date + '</span> <a href="' + item.link + '" target="_blank">' + item.title
                    + '</a></li>';
            }

            ul.html(html);
            cache.setItem('feed', html);
        }, 'json');
    }

    function applyUpdate(update) {
        if (update.available) {
            $('<div class="update-check message error"><p>'
                + '您当前使用的版本是 %s'.replace('%s', update.current) + '<br />'
                + '<strong><a href="' + update.link + '" target="_blank">'
                + '官方最新版本是 %s'.replace('%s', update.latest) + '</a></strong></p></div>')
            .insertAfter('.typecho-page-title').effect('highlight');
        }
    }

    if (!!update) {
        applyUpdate($.parseJSON(update));
    } else {
        $.get('https://uioi.cn/index.php/action/ajax?do=checkVersion', function (o, status, resp) {
            applyUpdate(o);
            cache.setItem('update', resp.responseText);
        }, 'json');
    }
});


请问有什么靠谱的解决方法?谢谢
头像
[email protected]
帖子: 28
注册时间: 2019年 8月 19日 14:51
联系:

Re: 1.1稳定版后台页js报错

帖子 [email protected] »

if (update && update.available) {

改一下这一行就行了。 另外这个报错可以无视。

在 admin/index.php
回复