Skip to content

Commit 4114596

Browse files
Merge pull request #8 from omarmahdzan/patch-3
Beautify javascript indentation
2 parents aa2ec4d + 22c211a commit 4114596

1 file changed

Lines changed: 65 additions & 51 deletions

File tree

Lines changed: 65 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,66 @@
11
$(function() {
2-
$.ajaxSetup({ cache: true });//Enable catching - jQuery will timestamp by default.
3-
//$.getScript('//connect.facebook.net/en_US/sdk/debug.js', function(){
4-
$.getScript('//connect.facebook.net/en_US/all.js', function(){
5-
6-
FB.init({
7-
appId: '(Your FB AppID)',
8-
});
9-
10-
FB.getLoginStatus(function(response) {
11-
if (response.status === 'connected'){
12-
console.log('Logged in.');
13-
FB.api('/me', function(response) {
14-
//
15-
16-
/*BELOW: 2 lines of code that set the bill_name and bill_email automatically. The setting is
17-
** on data attributes. Then the rest is done as in usual seamless integration.
18-
##USER: have to link to MOLPay facebook .js after linking to jQuery but before linking to
19-
## MOLPay seamless .js.
20-
*/
21-
22-
$('#molpay_btn').html("<button type=\"button\" id=\"myPay\" class=\"btn btn-primary btn-lg\" data-toggle=\"molpayseamless\" data-mpsmerchantid=\"molpaymerchant\" data-mpschannel=\"maybank2u\" data-mpsamount=\"1.20\" data-mpsorderid=\"TEST1139669863\" data-mpsbill_name=\"\" >Pay by Maybank2u</button>");
23-
24-
var var_mpsbill_name = response.name;
25-
var var_mpsbill_email = response.email;
26-
if($("[data-toggle=\"molpayseamless\"]")){ $("[data-toggle=\"molpayseamless\"]").attr('data-mpsbill_name', var_mpsbill_name)}else{ $("[data-toggle=molpayseamless]").attr('data-mpsbill_name', var_mpsbill_name);}//End of if()
27-
if($("[data-toggle=\"molpayseamless\"]")){ $("[data-toggle=\"molpayseamless\"]").attr('data-mpsbill_email', var_mpsbill_email);}else{ $("[data-toggle=molpayseamless]").attr('data-mpsbill_email', var_mpsbill_email);}//End of if()
28-
if($("[data-toggle=\"molpayseamless\"]")){ $("[data-toggle=\"molpayseamless\"]").attr('data-mpsreturnurl', window.location.href);}else{ $("[data-toggle=molpayseamless]").attr('data-mpsreturnurl', window.location.href);}//End of if()
29-
30-
alert("BILL_NAME: " + $("[data-toggle=molpayseamless]").attr('data-mpsbill_name') + "\n\nBILL_EMAIL: " + $("[data-toggle=molpayseamless]").attr('data-mpsbill_email') + "\n\nBILL_AMOUNT: " + $("[data-toggle=molpayseamless]").attr('data-mpsamount') + "\n\nMERCHANTID: " + $("[data-toggle=molpayseamless]").attr('data-mpsmerchantid'));
31-
});
32-
console.log('Logged in=> DONE');
33-
}else{
34-
//
35-
console.log('NOT LOGGED IN');
36-
FB.login(function(response){
37-
//
38-
//alert("Login response....");
39-
console.log('LOGIN RESPONSE....');
40-
41-
window.location = window.location.href;
42-
43-
console.log('LOGIN RESPONSE....=> DONE');
44-
},
45-
{scope: 'public_profile,email'}
46-
);
47-
//alert("else");
48-
console.log('NOT Logged in=> DONE');
49-
}//End of if()
50-
});
51-
});
52-
});
2+
$.ajaxSetup({
3+
cache: true
4+
}); //Enable catching - jQuery will timestamp by default.
5+
//$.getScript('//connect.facebook.net/en_US/sdk/debug.js', function(){
6+
$.getScript('//connect.facebook.net/en_US/all.js', function() {
7+
8+
FB.init({
9+
appId: '(Your FB AppID)',
10+
});
11+
12+
FB.getLoginStatus(function(response) {
13+
if (response.status === 'connected') {
14+
console.log('Logged in.');
15+
FB.api('/me', function(response) {
16+
//
17+
18+
/*BELOW: 2 lines of code that set the bill_name and bill_email automatically. The setting is
19+
** on data attributes. Then the rest is done as in usual seamless integration.
20+
##USER: have to link to MOLPay facebook .js after linking to jQuery but before linking to
21+
## MOLPay seamless .js.
22+
*/
23+
24+
$('#molpay_btn').html("<button type=\"button\" id=\"myPay\" class=\"btn btn-primary btn-lg\" data-toggle=\"molpayseamless\" data-mpsmerchantid=\"molpaymerchant\" data-mpschannel=\"maybank2u\" data-mpsamount=\"1.20\" data-mpsorderid=\"TEST1139669863\" data-mpsbill_name=\"\" >Pay by Maybank2u</button>");
25+
26+
var var_mpsbill_name = response.name;
27+
var var_mpsbill_email = response.email;
28+
if ($("[data-toggle=\"molpayseamless\"]")) {
29+
$("[data-toggle=\"molpayseamless\"]").attr('data-mpsbill_name', var_mpsbill_name)
30+
} else {
31+
$("[data-toggle=molpayseamless]").attr('data-mpsbill_name', var_mpsbill_name);
32+
} //End of if()
33+
if ($("[data-toggle=\"molpayseamless\"]")) {
34+
$("[data-toggle=\"molpayseamless\"]").attr('data-mpsbill_email', var_mpsbill_email);
35+
} else {
36+
$("[data-toggle=molpayseamless]").attr('data-mpsbill_email', var_mpsbill_email);
37+
} //End of if()
38+
if ($("[data-toggle=\"molpayseamless\"]")) {
39+
$("[data-toggle=\"molpayseamless\"]").attr('data-mpsreturnurl', window.location.href);
40+
} else {
41+
$("[data-toggle=molpayseamless]").attr('data-mpsreturnurl', window.location.href);
42+
} //End of if()
43+
44+
alert("BILL_NAME: " + $("[data-toggle=molpayseamless]").attr('data-mpsbill_name') + "\n\nBILL_EMAIL: " + $("[data-toggle=molpayseamless]").attr('data-mpsbill_email') + "\n\nBILL_AMOUNT: " + $("[data-toggle=molpayseamless]").attr('data-mpsamount') + "\n\nMERCHANTID: " + $("[data-toggle=molpayseamless]").attr('data-mpsmerchantid'));
45+
});
46+
console.log('Logged in=> DONE');
47+
} else {
48+
//
49+
console.log('NOT LOGGED IN');
50+
FB.login(function(response) {
51+
//
52+
//alert("Login response....");
53+
console.log('LOGIN RESPONSE....');
54+
55+
window.location = window.location.href;
56+
57+
console.log('LOGIN RESPONSE....=> DONE');
58+
}, {
59+
scope: 'public_profile,email'
60+
});
61+
//alert("else");
62+
console.log('NOT Logged in=> DONE');
63+
} //End of if()
64+
});
65+
});
66+
});

0 commit comments

Comments
 (0)