48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
// Generated by CoffeeScript 1.12.8
|
|
(function() {
|
|
var sendUrl, tryssl;
|
|
|
|
tryssl = function() {
|
|
var path;
|
|
path = window.location.pathname;
|
|
console.log('path -> ', path);
|
|
console.log('Call URL -> ', window.datas.sslHost);
|
|
$.ajax(window.datas.sslHost, {
|
|
dataType: 'jsonp',
|
|
statusCode: {
|
|
401: function() {
|
|
$('#lform').submit();
|
|
return console.log('Error code 401');
|
|
}
|
|
},
|
|
success: function(data) {
|
|
sendUrl(path);
|
|
return console.log('Success -> ', data);
|
|
},
|
|
error: function() {
|
|
sendUrl(path);
|
|
return console.log('Error');
|
|
}
|
|
});
|
|
return false;
|
|
};
|
|
|
|
sendUrl = function(path) {
|
|
var form_url;
|
|
form_url = $('#lform').attr('action');
|
|
if (form_url.match(/^#$/)) {
|
|
form_url = path;
|
|
} else {
|
|
form_url = form_url + path;
|
|
}
|
|
console.log('form action URL -> ', form_url);
|
|
$('#lform').attr('action', form_url);
|
|
return $('#lform').submit();
|
|
};
|
|
|
|
$(document).ready(function() {
|
|
return $('.sslclick').on('click', tryssl);
|
|
});
|
|
|
|
}).call(this);
|