PageSourceSearch

https://www.sea-land.com.tw/js/socialLogin.js

js sea-land.com.tw collected 2026-09-26 08:05:51 UTC 4,826 bytes, 151 lines download raw bytes

1/**
2 * FB登入
3 */
4window.fbAsyncInit = function() {
5    FB.init({
6        appId: _fbAppID,
7        xfbml: true,
8        version: 'v3.0'
9    });
10};
11
12(function(d, s, id) {
13    var lang = "zh-TW";
14    switch(_lang) {
15        case "en":
16            lang = "en_US";
17            break;
18        case "ja":
19        case "jp":
20            lang = "ja_JP";
21            break;
22        case "ko":
23        case "kr":
24            lang = "ko_KR";
25            break;
26        default:
27            lang = _lang[0]+_lang[1]+"_"+(_lang[3]?_lang[3].toUpperCase():"")+(_lang[4]?_lang[4].toUpperCase():"")
28    }
29    var js, fjs = d.getElementsByTagName(s)[0];
30    if (d.getElementById(id)) { return; }
31    js = d.createElement(s);
32    js.id = id;
33    js.src = "//connect.facebook.net/"+lang+"/sdk.js"; //FB的多國一定要語言_大寫區碼 zh-TW ja_JP
34    fjs.parentNode.insertBefore(js, fjs);
35}(document, 'script', 'facebook-jssdk'));
36
37
38function statusChangeCallback(response) {
39    FB.api('/me', { fields: 'id,name,email,birthday,picture' }, function(response) {
40
41        $.ajax({
42            url: _jsPath+"/ajax.php",
43            type: "GET",
44            data: {
45                socialLogin: 'fb',
46                id: response.id,
47                name: response.name,
48                email: response.email,
49                picture: response.picture.data.url
50            },
51            dataType:'text',
52            async: false,
53            success: function(msg){
54                if(msg){
55                    if(window.location.href.indexOf("?") != -1){
56                        window.location.href = window.location.href+"&socialLogin=fb";
57                    }else{                            
58                        window.location.href = window.location.href+"?socialLogin=fb";
59                    }
60                }
61            }
62        });
63    });
64}
65
66
67function fbLogin() {
68    FB.login(function(response) {
69        if (response.status === 'connected') {
70            statusChangeCallback(response);
71        }
72    }, { scope: 'email' });//,user_birthday,user_gender
73}
74
75function fbLogout() {
76    FB.getLoginStatus(function(response) {
77        if (response.status === 'connected' || response.status === 'authorization_expired' || response.status === 'not_authorized') {
78            FB.logout(function(response) {
79                var url = '//www.facebook.com/logout.php?access_token=' 
79+ response.authResponse.accessToken;
80                $('body').append('<iframe src="'+url+'" height="0" width="0" frameborder="0" scrolling="no" id="myFrame"></iframe>');
81            });
82        }
83    });
84}
85
86/**
87 * Line登入
88 */
89function lineLogin() {
90    window.open(_jsPath+'/include/LineLogin/line_login.php'
91                , 'Line'
92                , config='height=550,width=500,left='+(window.screen.width-500)/2+',top='+(window.screen.height-550)/2);
93}
94
95
96
97
98/**
99 * Google登入
100 * <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
101 * <script src="https://apis.google.com/js/api:client.js"></script>
102 * <a id="GoogleBtn">login</a>
103 */
104var googleUser = {};
105var startApp = function() {
106    gapi.load('auth2', function() {
107        auth2 = gapi.auth2.init({
108            client_id: _googleClientID,
109            cookiepolicy: 'single_host_origin',
110        });
111        attachSignin(document.getElementById('GoogleBtn'));
112    });
113};
114
115function attachSignin(element) {
116    // console.log(element.id);
117    auth2.attachClickHandler(element, {},
118        function(googleUser) {
119            var profile = googleUser.getBasicProfile();
120            $.ajax({
121                url: _jsPath+"/ajax.php",
122                type: "GET",
123                data: {
124                    socialLogin: 'google',
125                    id: profile.getId(),
126                    name: profile.getName(),
127                    email: profile.getEmail(),
128                    picture: profile.getImageUrl()
129                },
130                dataType:'text',
131                async: false,
132                success: function(msg){
133                    if(msg){
134                        if(window.location.href.indexOf("?") != -1){
135                            window.location.href = window.location.href+"&socialLogin=google";
136                        }else{                            
137                            window.location.href = window.location.href+"?socialLogin=google";
138                        }
139                    }
140                }
141            });
142        },
143        function(error) {
144            // alert(_jsMsg["GOOGLE_SIGNIN_ERROR"] + JSON.stringify(error, undefined, 2));
145        });
146}
147$(function(){
148    if(typeof($('#GoogleBtn').val())!="undefined"){
149        startApp();
150    }
151});

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.