PageSourceSearch

https://thriftytraveler.com/wp-content/plugins/tt-pys/assets/js/tt-pys.js?ver=0.1.0

js thriftytraveler.com collected 2026-10-02 02:35:00 UTC 1,983 bytes, 64 lines download raw bytes

1function tt_pys( $ ) {
2    var tt_pys = {
3        config: null,
4
5        init: function () {
6            this.config = window.tt_pys_config;
7            this.bind_events();
8        },
9
10        bind_events: function () {
11            var self = this;
12
13            $( document ).on( 'tt:logged-in-state:ready:success', function () {
14                self.handle_logged_in_state( window.tt && window.tt.logged_in_state );
15            } );
16        },
17
18        handle_logged_in_state: function ( state ) {
19            if ( ! this.should_apply( state ) ) {
20                return;
21            }
22
23            var self = this;
24
25            this.external_id_for( state.user_id ).then( function ( external_id ) {
26                self.set_pbid_cookie( external_id );
27            } );
28        },
29
30        should_apply: function ( state ) {
31            return !! ( state && state.is_logged_in && state.user_id );
32        },
33
34        external_id_for: function ( user_id ) {
35            var bytes = new TextEncoder().encode( String( user_id ) );
36
37            return crypto.subtle.digest( 'SHA-256', bytes ).then( function ( buffer ) {
38                return Array.from( new Uint8Array( buffer ) ).map( function ( byte ) {
39                    return byte.toString( 16 ).padStart( 2, '0' );
40                } ).join( '' );
41            } );
42        },
43
44        set_pbid_cookie: function ( external_id ) {
45            document.cookie = this.config.cookie_name + '=' + external_id
46                + '; path=/'
47                + '; domain=' + this.config.cookie_domain
48                + '; max-age=' + this.config.cookie_max_age_seconds
49                + '; samesite=lax; secure';
50
51            console.log( '[tt-pys] Linked pbid to member external id: ' + external_id );
52        }
53    };
54
55    return tt_pys;
56}
57
58if ( typeof module !== 'undefined' && module.exports ) {
59    module.exports = tt_pys;
60}
61
62if ( typeof window !== 'undefined' && window.jQuery && window.document ) {
63    tt_pys( jQuery ).init();
64}

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.