PageSourceSearch

https://editio.pl/assets/editio/js/user_info.js

js editio.pl collected 2026-09-26 10:45:26 UTC 4,594 bytes, 119 lines download raw bytes

1$.ajax({
2    url:'/api/users/info',
3    method: 'get',
4    success: function(api){
5        data = api;
6        window._users = data;
7        if (data.ile > 0) {
8            $("#koszykbox").html('<p id="koszykbox_suma" style="display:inline;">' + data.suma +'</p> <p id="koszykbox_ile" style="display:inline;">('+data.ile+')</p>')
9            if($(document).width()<600){
10                $('.login-links').css('left', '95px');
11            }
12        }
13
14        $("#ile-n-archiwum-ebook").html(" (" + data.biblioteka.ebooks + ")");
15        $("#ile-n-archiwum-audiobook").html(" (" + data.biblioteka.audiobooks + ")");
16        $("#ile-n-archiwum-kurs").html(" (" + data.biblioteka.courses + ")");
17        $("#ile-kurs-dodatki").html(" (" + data.biblioteka.addition + ")");
18        $(".ile-archiwum-ebook").html(" (" + data.archiwum.ebooks + ")");
19        $(".ile-archiwum-audiobook").html(" (" + data.archiwum.audiobooks + ")");
20        $(".ile-archiwum-kursy").html(" (" + data.archiwum.courses + ")");
21        $("#ile-prezenty").html(" (" + data.prezenty + ")");
22        $("#ile-kurs-materialy").html(" (" + data.materialy + ")");
23        $("#ile-sample").html(" (" + data.sample + ")");
24        if (data.login) {
25            if (data.sample > 0 && data.last_sample != "" && !$.cookie("hidesampleinfo")) {
26                $(".sample-info .sample-info-title").html(data.last_sample);
27                $(".sample-info").show();
28            }
29            if( typeof ga !== 'undefined') {
30              ga("set", "&uid", data.uid);
31              ga("set", "dimension1", data.uid);
32            }
33            $(".login-links span").html(
34                "<a class='login-link' id='logowanie' href='/users/logout'>Wyloguj się</a>"
35            );
36            $('.top-icon-profile').addClass("is-logged");
37            $('.account-menu-mobile').addClass("is-logged");
38
39            if (data.biblioteka) {
40                if (data.biblioteka.ebooks == 0) {
41                    $("#ile-n-archiwum-ebook2").closest("li").addClass("disable");
42                }
43                $("#ile-n-archiwum-ebook2").html("(" + data.biblioteka.ebooks + ")");
44
45                if (data.biblioteka.audiobooks == 0) {
46                    $("#ile-n-archiwum-audiobook2").closest("li").addClass("disable");
47                }
48                $("#ile-n-archiwum-audiobook2").html("(" + data.biblioteka.audiobooks + ")");
49
50                if (data.biblioteka.courses == 0) {
51                    $("#ile-n-archiwum-kurs2").closest("li").addClass("disable");
52                }
53                $("#ile-n-archiwum-kurs2").html("(" + data.biblioteka.courses + ")");
54            }
55
56            if (data.prezenty == 0) {
57                $("#ile-prezenty2").closest("li").addClass("disable");
58            }
59            $("#ile-prezenty2").html("(" + data.prezenty + ")");
60
61            if (data.sample) {
62                $("#ile-sample2").html("(" + data.sample + ")");
63            } else {
64                $("#ile-sample2").closest("li").addClass("disable");
65            }
66        }
67    }
68});
69$(document).ready(function(){
70    if (readCookie('nomobile') === 'true'){
71        $(".change-device-not-mobily").show();
72        $(".modalbuttonscontainer").css("height", "100%");
73    } else{
74        $(".change-device-not-mobily").hide();
75    }
76});
77
78// full email hiding
79const bookstore = window._bookstore;
80
81$("p:contains('@" + bookstore + "')").each(function(){
82    if($(this).html().indexOf("href")==-1){
83        const re = /\w+@\w+\.\w{2}/;
84        $(this).html($(this).html().replace(re,"<a href='mailto:\$&'>\$&</a>"));
85    }
86});
87
88let hideEmail = function(email) {
89    return email.replace(/(.{0})(.*)(?=@)/,
90    function(gp1, gp2, gp3) {
91        for(let i = 0; i < gp3.length; i++) {
92            gp2+= "* ";
93        }
94        return "[wyświetl email]";
95     });
96};
97
98$('a[href^="mailto:"]').each(function() {
99    $(this).text(hideEmail($(this).text()))
100});
101
102$('a[href^="mailto:"]').each(function() {
103    $(this).on("click", function(e){
104        if($(this).attr('href').indexOf('?')>-1){
105            if($(this).text()!=$(this).attr('href').substring(7,$(this).attr('href').indexOf('?'))){
106                $(this).text($(this).attr('href').substring(7,$(this).attr('href').indexOf('?')));
107                e.preventDefault();
108                e.stopPropagation();
109            }
110        }
111        else{
112            if($(this).text()!=$(this).attr('href').substring(7)){
113                $(this).text($(this).attr('href').substring(7));
114                e.preventDefault();
115                e.stopPropagation();
116            }
117        }
118    });
119});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.