PageSourceSearch

https://www.pietarsaarensanomat.fi/wp-content/plugins/payway-wordp…/public/js/wp-tulo.js?ver=1.0.4

js pietarsaarensanomat.fi collected 2026-09-26 18:50:34 UTC 4,037 bytes, 61 lines download raw bytes

1// Get token from cookies
2function getCookie(name) {
3    var cookies = document.cookie ? document.cookie.split(';') : [];
4    for (var i = 0; i < cookies.length; i++) {
5        var cookie = cookies[i].trim();
6        if (cookie.indexOf(name + '=') === 0) {
7            return unescape(cookie.substring(name.length + 1));
8        }
9    }
10    return null;
11}
12
13// Get Payload object value from token 
14function parseJwt (token) {
15    token = token.trim();
16    if ( token !== null ) {
17        var base64Url = token.split('.')[1];
18        //console.log(base64Url);
19        if ( base64Url == null ) {
20            base64Url = token;
21        }
22        //console.log( base64Url );
23        var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
24        var jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function(c) {
25            return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
26        }).join(''));
27        return JSON.parse(jsonPayload);
28    }
29}
30// function to check bot
31function isHuman() {
32    var botPattern = "(googlebot\/|bot|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)";
33    var re = new RegExp(botPattern, 'i');
34    var userAgent = navigator.userAgent;
35    if (re.test(userAgent)) {
36        return false;
37    } else {
38        return true;
39    }
40}
41function nav_tulo_sso() {
42  if( isHuman() ) {
43    console.log('Working JS!');
44    var cookValue = getCookie("nw_session");
45    var hrefvalue = window.location.href;
46    var baseurl   = window.location.origin;
47    if( cookValue ) {
48      var SCookieArr = parseJwt(cookValue);
49      var SCookieCreated = SCookieArr['iat'];
50      var SCookieCreatedWith5min = (SCookieCreated *1000) + 30*10000; //add 5min 300
51      var SCookieCreatedWith60min = (SCookieCreated + 3600) * 1000;
52      // check for cookie expiration
53      if( Date.now() > SCookieCreatedWith60min ) {
54        window.location.href = baseurl + "/wp-content/plugins/payway-wordpress-sso2-main/landing-redirect.php?action=loginstatus&r=" + encodeURIComponent(hrefvalue);
55      }
56    } else {
57      window.location.href = baseurl + "/wp-content/plugins/payway-wordpress-sso2-main/landing-redirect.php?action=preidentify&r=" + encodeURIComponent(hrefvalue);
58    }
59  }
60}
61nav_tulo_sso();

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.