PageSourceSearch

https://papaken.life/static/js/aten/shop.js?1790863609

js papaken.life collected 2026-10-07 11:31:25 UTC 4,208 bytes, 173 lines download raw bytes

1$(function()
2{
3	/* BEGIN 購物免登入相關功能 */
4	$('#shop_checkout_link_join_to_login, #shop_checkout_link_forget_password_to_login').click(function() {
5		shop_checkout_switch_to_loin_block();
6	});
7
8	$('#shop_checkout_link_join_to_forget_password, #shop_checkout_link_login_to_forget_password').click(function() {
9		shop_checkout_switch_to_forget_password_block();
10	});
11
12	$('#shop_checkout_link_login_to_join, #shop_checkout_link_forget_password_to_join').click(function() {
13		shop_checkout_switch_to_join_block();
14	});
15	/* END 購物免登入相關功能 */
16});
17
18/* BEGIN 購物免登入相關功能 */
19function shop_checkout_switch_to_loin_block()
20{
21	var join_block						= $('#block_user_join');
22	var loin_block						= $('#block_user_login');
23	var forget_password_block			= $('#block_forget_password');
24
25	$(loin_block).delay(300).fadeIn(500);
26	$(join_block).fadeOut(300);
27	$(forget_password_block).fadeOut(300);
28
29	sweetAlert.close();
30}
31
32function shop_checkout_switch_to_forget_password_block()
33{
34	var join_block						= $('#block_user_join');
35	var loin_block						= $('#block_user_login');
36	var forget_password_block			= $('#block_forget_password');
37
38	$(forget_password_block).delay(300).fadeIn(500);
39	$(join_block).fadeOut(300);
40	$(loin_block).fadeOut(300);
41
42	sweetAlert.close();
43}
44
45function shop_checkout_switch_to_join_block()
46{
47	var join_block						= $('#block_user_join');
48	var loin_block						= $('#block_user_login');
49	var forget_password_block			= $('#block_forget_password');
50
51	$(join_block).delay(300).fadeIn(500);
52	$(loin_block).fadeOut(300);
53	$(forget_password_block).fadeOut(300);
54
55	sweetAlert.close();
56}
57
58function shop_checkout_login()
59{
60	var email							= $('input[name=login_email]').val();
61	var user_password					= $('input[name=login_password]').val();
62	var url								= $('#shop_checkout_login').data('order-login-url');
63	if(url==undefined || url.length==0)
64		return;
65
66	$.post(url,
67	{
68		user_id:						email,
69		user_password:					user_password,
70	}, function(res)
71	{
72		if(res.status=='ok')
73		{
74			var info_block				= $('#block_user_info');
75			var join_block				= $('#block_user_join');
76			var loin_block				= $('#block_user_login');
77			var forget_password_block	= $('#block_forget_password');
78
79			info_block.show();
80			join_block.hide();
81			loin_block.hide();
82			forget_password_block.hide();
83
84			$('#current_user_name').html(t('Name: %s', res.user_name));
85			$('#current_user_id').html('Email:' + res.user_id);
86			// $('#current_user_mobile').html('電話:' + res.user_mobile);
87			refresh_menu_user_info();// from member.js
88
89			// 2023-07-02 這邊要判斷 商品種類是否需要收貨資料
90			// 如果收貨資料是空的
91			// 要用 user 資料去補 收貨資料
92			shop_checkout_get_shipping_data();
93
94			// refresh 購物清單
95			shop_checkout_get_shopping_list();
96		}
97		else if(res.status=='err')
98		{
99			swal(t('Login failed'));
100		}
101		else
102		{
103			swal(t('Login failed'));
104		}
105	}, 'json');
106}
107
108function shop_checkout_get_shipping_data()
109{
110	$.get('member/get_shipping_data', function(res)
111	{
112		if(res.status=='no_login')
113		{
114			return;
115		}
116		else
117		{
118			$('input[name=rcpt_name]').val(res.rcpt_name);
119			$('input[name=rcpt_tele]').val(res.rcpt_tele);
120			$('input[name=rcpt_address]').val(res.rcpt_address);
121		}
122	}, 'json');
123}
124
125function shop_checkout_get_shopping_list()
126{
127	$.get('cart/get_shopping_list', function(res)
128	{
129		$('#shopping-list').html(res);
130	});
131}
132
133function shop_checkout_reset_password_submit(email)
134{
135	if(email==undefined)
136	{
137		email							= $('input[name=join_email]').val();
138	}
139	if(email.length==0)
140	{
141		sweetAlert({
142			title: t('Cart checkout'),
143			text: t('Please enter an email address')
144		}, function()
145		{
146		});
147		return;
148	}
149
150	var url								= $('#order_submit').data('reset-password-url');
151	if(url==undefined || url.length==0)
152		return;
153	var site_key						= $('#forget_password_button').data('sitekey');
154
155	aten_recaptcha_execute(site_key, 'submit', function(captcha)
156	{
157
158		$.post(url,
159		{
160			email:							email,
161			captcha:						captcha,
162		}, function(res)
163		{
164			sweetAlert({
165				title: t('Cart checkout'),
166				text: t('A new password has been sent to your inbox')
167			}, function(){
168
169			});
170		});
171	});
172}
173/* END 購物免登入相關功能 */

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.