PageSourceSearch

https://www.gamearter.com/game/static/gp/authorizator.js

js gamearter.com collected 2026-09-26 03:18:57 UTC 2,643 bytes, 104 lines download raw bytes

1function connector(){};
2var Auth = new connector();
3
4
5connector.prototype.init = function()
6{
7    Auth.addLogoutListener();
8};
9
10
11/**
12 * Autorizace nad vlastnim webem
13 * @param object response
14 */
15connector.prototype.logged = function(response)
16{
17    Auth.destroyDialog();
18    try {
19        Garter.loginCallback(response);
20    } catch(e) {
21        console.info(e);
22    }
23    
24    parent.postMessage({status: 'logged', response: response}, 'https://www.gamearter.com');    
25};
26
27
28connector.prototype.messageReciever = function(MessageEvent)
29{
30    if (MessageEvent.origin !== 'https://auth.gamearter.com') { return; }
31        
32    try {
33        data = JSON.parse(MessageEvent.data);
34    } catch(e) {
35        data = MessageEvent.data;
36    }
37    
38    console.warn('[authorizator] message from ' + MessageEvent.origin, data);   
39    
40    if ('status' in data && data.status === 'logout')
41    {
42        Auth.destroyIframe();
43        
44        try {
45            Garter.loginCallback({action: 'log-out', data:{}});
46        } catch (e) {
47            console.info(e);
48        }
49    
50        parent.postMessage({status: 'logout'}, 'https://www.gamearter.com');
51
52        Auth.addLogoutListener();
53    }
54};
55
56
57connector.prototype.logout = function()
58{
59    Auth.destroyIframe();
60    
61    // vtvoreni iframe, ktery vyvola proces odhlaseni na GA
62    var ifrm = document.createElement('iframe'); 
63        ifrm.setAttribute('src', 'https://auth.gamearter.com/logout');
64        ifrm.setAttribute('id', 'ga-logoutiframe-1');
65        ifrm.style.width  = 0;
66        ifrm.style.height = 0;
67        ifrm.style.border = 'none';    
68    document.body.appendChild(ifrm);
69
70    window.addEventListener('message', Auth.messageReciever);
71};
72
73
74connector.prototype.destroyIframe = function()
75{
76    var element = document.getElementById('ga-logoutiframe-1');
77    if (element !== null)
78    {
79        element.parentNode.removeChild(element);
80        window.removeEventListener('message', Auth.messageReciever);
81    }
82};
83
84connector.prototype.destroyDialog = function()
85{
86    var element = document.getElementById('gasso');
87    if (element !== null)
88    {
89        element.parentNode.removeChild(element);
90    }
91};
92
93
94connector.prototype.addLogoutListener = function()
95{
96    // toto se pouziva na hlavnim webu. Druhy (stejny) listener je v Gameplayeru
97    if (document.getElementById('ga-logoutbutton-1') !== null)
98    {
99        document.getElementById('ga-logoutbutton-1').addEventListener('click', Auth.logout);
100    }
101};
102
103
104document.addEventListener('DOMContentLoaded', Auth.init);

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.