PageSourceSearch

https://digisotekeskus.pohde.fi/sotekeskus.js

js pohde.fi collected 2026-10-03 19:39:20 UTC 11,884 bytes, 219 lines download raw bytes

1//Localstorage-slim
2!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ls=e():t.ls=e()}(this,(function(){return(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>p});const r=(...t)=>{},n=t=>null!==t&&"Object"===t.constructor.name;let c;const o=()=>{if(void 0!==c)return c;try{localStorage||(c=!1)}catch(t){c=!1}return c=!0,i(),c},l=String.fromCharCode(0),a=(t,e,r=!0)=>r?[...JSON.stringify(t)].map((t=>String.fromCharCode(t.charCodeAt(0)+e))).join(""):JSON.parse([...t].map((t=>String.fromCharCode(t.charCodeAt(0)-e))).join("")),s={ttl:null,encrypt:!1,encrypter:a,decrypter:(t,e)=>a(t,e,!1),secret:75},i=(t=!1)=>{if(!o())return!1;Object.keys(localStorage).forEach((e=>{const r=localStorage.getItem(e);if(!r)return;let c;try{c=JSON.parse(r)}catch(t){return}n(c)&&l in c&&(Date.now()>c.ttl||t)&&localStorage.removeItem(e)}))},p={config:s,set:(t,e,n={})=>{if(!o())return!1;const c=Object.assign(Object.assign(Object.assign({},s),n),{encrypt:!1!==n.encrypt&&(n.encrypt||s.encrypt),ttl:null===n.ttl?null:n.ttl||s.ttl});try{let n=c.ttl&&c.ttl>0?{[l]:e,ttl:Date.now()+1e3*c.ttl}:e;c.encrypt&&(c.ttl&&l in n?n[l]=(c.encrypter||r)(n[l],c.secret):n=(c.encrypter||r)(n,c.secret)),localStorage.setItem(t,JSON.stringify(n))}catch(t){return!1}},get:(t,e={})=>{if(!o())return null;const c=localStorage.getItem(t);if(!c)return null;const a=Object.assign(Object.assign(Object.assign({},s),e),{encrypt:!1!==e.encrypt&&(e.encrypt||s.encrypt),ttl:null===e.ttl?null:e.ttl||s.ttl});let i=JSON.parse(c);const p=n(i)&&l in i;if(a.decrypt||a.encrypt)try{p?i[l]=(a.decrypter||r)(i[l],a.secret):i=(a.decrypter||r)(i,a.secret)}catch(t){}return p?Date.now()>i.ttl?(localStorage.removeItem(t),null):i[l]:i},flush:i,clear:()=>{if(!o())return!1;localStorage.clear()},remove:t=>{if(!o())return!1;localStorage.removeItem(t)}};return e.default})()}));
3
4//ladataan chatti-painike
5var eChatLocation = "";
6var eChatstyleSheetAdded = 0;
7var chatStorage = window.ls;
8var chatInitCond = 0;
9var initSrc = "";
10var initId = "";
11var embedLang = "fi";
12function eChatInit()
13{
14    if(window.chatInitCond==1)
15    {
16        eChatStart(window.initSrc);
17    }
18    else
19    {
20        var chats = document.getElementsByClassName("embedScript");
21        for(var i = 0; i < chats.length; i++)
22        {
23            //muuttujat
24            widget_link = chats[i];
25            var div = document.createElement('div');
26            div.setAttribute('style','position:fixed; top: auto; bottom: 0; left: auto; right: 15px; z-index: 100000;');
27            div.setAttribute('id','eChatBtn');
28            div.setAttribute('class','eChatInitContainer');
29            var client_id = parseInt(widget_link.getAttribute('data-client'));
30            var label = widget_link.getAttribute('data-label');
31            var auto_open = widget_link.getAttribute('data-auto-open');
32            var force_open = widget_link.getAttribute('data-force-open');
33            var language = widget_link.getAttribute('data-language');
34            if(language=="sv"){ language = "se"; }
35            if(language){ window.embedLang = language; }
36            window.eChatLocation = widget_link.src.replace("sotekeskus.js","");
37            
38            //osoiterivin erikoismuuttujat talteen (esim. Suomi.fi tunnistuksesta palautetut tunnistetiedot)
39            var queryString = window.location.search;
40            var urlParams = new URLSearchParams(queryString);
41            var chat_embed_channel = (urlParams?urlParams.get('chat_embed_channel'):null);
42            var channel_id = "";
43            var chat_channels = new Array();
44            chat_channels["aino-neuvonta"] = 410;
45            chat_channels["vammaispalvelut"] = 409;
46            chat_channels["pelastustoimi"] = 395;
47            chat_channels["neuvontapalvelut"] = 405;
48            chat_channels["neuvontapalvelut-siirto"] = 405405;
49            chat_channels["fysioterapia"] = 418;
50            chat_channels["suunterveys"] = 767;
51            chat_channels["potilasjasoschat"] = 818;
52            chat_channels["aino-neuvonta-demo"] = 340;
53            chat_channels["vammaispalvelut-demo"] = 341;
54            chat_channels["pelastustoimi-demo"] = 372;
55            chat_channels["neuvontapalvelut-demo"] = 385;
56            chat_channels["fysioterapia-demo"] = 309;
57            chat_channels["suunterveys-demo"] = 746;
58            chat_channels["potilasjasoschat-demo"] = 756;
59            chat_channels["tth-demo"] = 820;
60            chat_channels["tth"] = 893;
61            chat_channels["sosiaalipalvelujen-neuvonta"] = 913;
62            
63            //avataanko ennalta määritetty näkymä?
64            if(chat_embed_channel && chat_channels[chat_embed_channel])
65            {
66                channel_id = parseInt(chat_channels[chat_embed_channel]);
67            }
68
69            //poistetaan linkistä vielä mahdollinen versionumero
70            if(window.eChatLocation.indexOf("?ver=")>-1)
71            {
72                var url = window.eChatLocation.split("?ver=");
73                window.eChatLocation = url[0];
74            }
75            
76            if(client_id=="152")
77            {
78                var buttonLabel = "Aloita chat-keskustelu";
79            }
80            else
81            {
82                var buttonLabel = "Digitaalinen sote-keskus";
83                if(label && label!=null && label!=undefined && label!="undefined"){ var buttonLabel = label; }
84            }
85            
86            var chatBtn = "<button type=\"button\" class=\"eChatInit\" style=\"display: none;\" tabindex=\"0\" title=\""+buttonLabel+"\" aria-label=\""+buttonLabel+"\" id=\"chatBtn\">"+buttonLabel+"</button><div id=\"eChatContainer\"><!-- --></div>";
87            div.innerHTML = chatBtn;
88
89            //event-listener - CSP!
90            setTimeout(function()
91            {
92                document.getElementById("chatBtn").addEventListener("click", function()
93                {
94                    if(channel_id==405405)
95                    {
96                        eChatStart(window.eChatLocation+"static-embed?staticEmbed=1&level=2&tab=2&btnLabel=Aloita%20chat-keskustelu&botConv=1&embed=2&client="+client_id+"&btnLabel="+buttonLabel+"&lang="+(language?language:"")+(channel_id?"&channel_id=405":""));
97                    }
98                    else
99                    {
100                        eChatStart(window.eChatLocation+"static-embed?embed=2&client="+client_id+"&btnLabel="+buttonLabel+"&lang="+(language?language:"")+(channel_id?"&staticEmbed=1&level=2&channel_id="+channel_id:""));
101                    }
102                });
103            },50);
104
105            //lisätään upote aivan juureen
106            widget_link.parentNode.removeChild(widget_link);
107            document.getElementsByTagName("body")[0].appendChild(div);
108            
109            window.chatInitCond = 1;
110            
111            if(channel_id==405405)
112            {
113                window.initSrc = window.eChatLocation+"static-embed?embed=2&botConv=1&tab=2&client="+client_id+"&btnLabel="+buttonLabel+"&lang="+(language?language:"")+(channel_id?"&staticEmbed=1&level=2&channel_id=405":"");
114            }
115            else
116            {
117                window.initSrc = window.eChatLocation+"static-embed?embed=2&client="+client_id+"&btnLabel="+buttonLabel+"&lang="+(language?language:"")+(channel_id?"&staticEmbed=1&level=2&channel_id="+channel_id:"");
118            }
119                
120            var link = document.createElement( "link" );
121            link.href = (window.eChatLocation.indexOf("echat.fi")>-1 || window.eChatLocation.indexOf("pohde.fi")>-1?"https://d1800jcr87x5eo.cloudfront.net/":"https://d3ag7b2pf30p35.cloudfront.net/etuotteet/ekonsultaatio/") + "ui/css/embed.1.3.css?ver=2&dt="+(Math.floor(Math.random()*1000));
122            link.type = "text/css";
123            link.rel = "stylesheet";
124            document.getElementsByTagName( "body" )[0].appendChild( link );
125
126            var link2 = document.createElement( "link" );
127            link2.href = (window.eChatLocation.indexOf("echat.fi")>-1 || window.eChatLocation.indexOf("pohde.fi")>-1?"https://d1800jcr87x5eo.cloudfront.net/":"https://d3ag7b2pf30p35.cloudfront.net/etuotteet/ekonsultaatio/") + "ui/css/clients/embed_0_"+client_id+".css?dt="+(Math.floor(Math.random()*1000));
128            link2.type = "text/css";
129            link2.rel = "stylesheet";
130            document.getElementsByTagName( "body" )[0].appendChild( link2 );
131            
132            //avataan chatti auki automaattisesti (olettaen myös, ettei olla mobiilissa!) ja että edellisestä sulkemisesta on vähintään 5min
133            if(parseInt(window.innerWidth)>767 && window.chatStorage.get('chatHidden')!="1" && auto_open!="false" || force_open=="true" || parseInt(channel_id)>0)
134            {
135                setTimeout(function(){
136                    if(channel_id==405405)
137                    {
138                        eChatStart(window.eChatLocation+"static-embed?staticEmbed=1&level=2&tab=2&btnLabel=Aloita%20chat-keskustelu&botConv=1&embed=2&client="+client_id+"&btnLabel="+buttonLabel+"&lang="+(language?language:"")+(channel_id?"&channel_id=405":""));
139                    }
140                    else
141                    {
142                        eChatStart(window.eChatLocation+"static-embed?embed=2&client="+client_id+"&btnLabel="+buttonLabel+"&lang="+(language?language:"")+(channel_id?"&staticEmbed=1&level=2&channel_id="+channel_id:""));
143                    }
144                },2000);
145            }
146        }
147    }
148    
149    //käynnistetään kuuntelija vasta tässä vaiheessa viiveellä
150    setTimeout(function()
151    {
152        window.addEventListener("message", receiveMessage, true);
153    },1050);
154}
155
156//avataan chatti
157function eChatStart(src)
158{
159    window.chatStorage.remove('chatHidden');
160    var closeBtnLabel = "Sulje"; if(window.embedLang=="se"){ closeBtnLabel = "St&auml;ng"; }else if(window.embedLang=="en"){ closeBtnLabel = "Close"; }
161    var chatBtn = "<button type=\"button\" class=\"chatFrameCloseBtn\" tabindex=\"0\" id=\"chatFrameCloseBtn\" title=\""+closeBtnLabel+"\" arial-label=\""+closeBtnLabel+"\" style=\"\" onclick=\"eChatEnd();\">&nbsp;</button>";
162    var iframe = "<iframe class=\"chatFrame\" tabindex=\"0\" title=\"Chat\" arial-label=\"Chat\" src=\""+src+"\" width=\"360\" height=\"600\" id=\"chatFrame\" frameborder=\"0\" scrolling=\"\" style=\"\"></iframe>";
163    var container = document.getElementById("eChatContainer");
164    
165    container.innerHTML = chatBtn+""+iframe;
166}
167
168//suljetaan chatti
169var chatExitId = 0;
170function eChatEnd()
171{
172    var iframe = document.getElementById("chatFrame");
173    if (iframe)
174    {
175        var chatContainer = document.getElementById("eChatContainer");
176        if(chatContainer)
177        {
178            chatContainer.innerHTML = "<!-- -->";
179        }
180        window.chatStorage.set('chatHidden','1',{ttl:(60*30)});
181    }
182}
183
184//vastaanotetaan viesti
185function receiveMessage(event)
186{
187    //palautetaan vastaus
188    //vastaanotetaan HTA init ja muut infot...
189    if(event && event.origin && event.origin.indexOf("hoidontarpeenarvio")>-1 || event.data.source=="react-devtools-content-script")
190    {
191        
192    }    
193    else if(event.data=="true")
194    {
195        
196    }
197    else if(event.data=="resetStart")
198    {
199        
200    }
201    else if(event.data=="resetEnd")
202    {
203        
204    }
205    else
206    {
207        //disabloidaan FB-pixelin vaikutus bottiin!
208        var eventSize = Object.keys(event.data).length;
209        if(!event.data.pcmPixelPostMessageEvent && (event.data=="leaveChat" || event.data=="chatShutdown" || event.data=="false" || eventSize<20))
210        {
211            eChatEnd();        
212        }
213    }
214}
215
216//viivästetty init
217setTimeout(function(){
218    eChatInit();
219},1000);

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.