Birnbaum2001 / GCComment

7 stars 7 forks source link

GS CacheNote is not updated #41

Open lukeIam opened 4 years ago

lukeIam commented 4 years ago

Unfortunately I do not know the error message anymore, but therefor I have a possible fix (just quick testet with chrome):

var pageMethodCaller = function(text){
    var n = $("#viewCacheNote")
    , r = $("#editCacheNote")
    , t = $("#cacheNoteText")
    , u = $(".js-pcn-cancel")
    , f = $(".js-pcn-submit")
    , i = $(".js-pcn-status");

    t.val(text);

    $.ajax({
        type: "POST",
        url: "/seek/cache_details.aspx/SetUserCacheNote",
        cache: !1,
        contentType: "application/json; charset=utf-8",
        data:  JSON.stringify({
            dto: {
                et: text,
                ut: unsafeWindow.userToken
            }
        }),
        success: function(u) {
            var f = JSON.parse(u.d), e;
            if(f.success){
                n.text(f.note).data("default", !1);
                e = "/app/ui-icons/sprites/cache-types.svg#icon-" + f.badge;
                $("#activityBadge").find("use").attr("xlink:href", e);
                i.hide();
                r.hide();
                n.show();
            }
        },
        error: function() {
            i.text(window.resources.cacheNoteError).addClass("validation-error").show()
        }
    })
};

if(browser === "FireFox"){
    appendScript("text", "(" + pageMethodCaller.toString() + ")('" + text.replace(/'/g,"%27") + "'.replace('%27','\\''));");
}
else{
    pageMethodCaller(text);
}