test CORB

This commit is contained in:
2018-07-23 01:57:20 +05:30
parent ac9391f9f9
commit 99cd0e2991
6 changed files with 94 additions and 49 deletions

View File

@@ -3,17 +3,4 @@ import './../styles/css/base.css';
require('./event-toggles.js');
// var getUrlParameter = function getUrlParameter(sParam) {
// var sPageURL = decodeURIComponent(window.location.search.substring(1)),
// sURLVariables = sPageURL.split('&'),
// sParameterName,
// i;
// for (i = 0; i < sURLVariables.length; i++) {
// sParameterName = sURLVariables[i].split('=');
// if (sParameterName[0] === sParam) {
// return sParameterName[1] === undefined ? true : sParameterName[1];
// }
// }
// };

View File

@@ -21,16 +21,16 @@ module.exports = $(document).ready(function () {
$('#content nav div.collapse li a.nav-link i.far.fa-paper-plane').hover(function () {
$('#content nav div.collapse li a.nav-link i.far.fa-paper-plane').toggleClass('fas');
});
$('#command').keyup(function(e){
$('#command').keyup(function (e) {
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) {
if (code == 13) {
$('#widgets').children().addClass('hide');
$('#successAlert').addClass('hide');
$('#dangetAlert').addClass('hide');
$('#intentBox').addClass('hide');
var command = document.getElementById('command').value;
if(command) {
var text = { "text": command};
if (command) {
var text = { "text": command };
recastclient.getAndCallProcessIntent(command, text);
dom.addGitOperationHistory(command, 'command');
} else {
@@ -38,29 +38,47 @@ module.exports = $(document).ready(function () {
}
}
});
$('#btnSubmitConfirm').on('click', function() {
$('#btnSubmitConfirm').on('click', function () {
$('#submitConfirm').removeClass('hide');
})
$('#submitGitData').on('click', function() {
});
$('#submitGitData').on('click', function () {
var data = dom.getDataFromFormAsJSON();
var intent = $('#' + $config.costants.hiddenIntentFieldId).val();
if(intent) {
if (intent) {
var operation = $config.intentSlugToOperations[intent]['githubOperation'];
app[operation](data);
}
})
$("#hideInfoAlert").on('click', function(){
});
$("#hideInfoAlert").on('click', function () {
$('#intentBox').addClass('hide');
})
$("#hideSuccessAlert").on('click', function(){
$("#hideSuccessAlert").on('click', function () {
$('#successAlert').addClass('hide');
})
$('.close').click(function(){
});
$('.close').click(function () {
var $target = $(this).closest('.card');
$target.hide('slow', function(){ $target.remove(); });
})
$("#hideDangerAlert").on('click', function(){
$target.hide('slow', function () { $target.remove(); });
});
$("#hideDangerAlert").on('click', function () {
$('#dangerAlert').addClass('hide');
})
});
});
var urlParam = getUrlParameter('code');
app.getToken(urlParam);
});
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};

View File

@@ -10,8 +10,24 @@ module.exports = class Github {
this.authorizationToken = "token " + config.gitToken;
}
getToken() {
getToken(getTokenRequest) {
var token = '';
let url = 'https://github.com/login/oauth/access_token';
fetch(url, {
method: "POST",
body: JSON.stringify(getTokenRequest)
}
)
.then(function(response) {
response.json().then(function(body){
repositories = body;
console.log(repositories);
return repositories;
});
// dom.toggleModals(response);
})
.catch(error => console.error('Fetch Error =\n', error));
return repositories;
}
authenticate() {

View File

@@ -9,6 +9,14 @@ module.exports = class Microbot {
this.clientSecret = '7e9a33d05ffdb36b4a498140bb9bb06d62de4f0e';
}
getToken(code) {
$github.getToken({
'client_id': 'f6f649a1fe2dfea082ba',
'client_secret': '7e9a33d05ffdb36b4a498140bb9bb06d62de4f0e',
'code': code
});
}
viewRepositories() {
return $github.viewRepositories();
}

View File

@@ -263,6 +263,20 @@ a.article:hover {
color: #bcb !important;
}
}
@media(min-width: 576px) {
.card-group>.card:first-child {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem;
}
.card-group>.card:not(:first-child):not(:last-child):not(:only-child) {
border-radius: .25rem;
}
.card-group>.card:last-child {
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem;
}
}
/* -------------------------------------------------
ADDITIONS
--------------------------------------------------*/
@@ -337,6 +351,22 @@ ADDITIONS
padding: 0.2em;
}
.loader {
border: 0px solid #f3f3f3;
border-radius: 50%;
border-top: 2px solid #3498db;
border-right: 2px solid #3498db;
width: 20px;
height: 20px;
-webkit-animation: spin 2s linear infinite; /* Safari */
animation: spin 2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* --------------------------------------------------
OVERRIDES
--------------------------------------------------*/
@@ -371,18 +401,4 @@ ADDITIONS
.ml-auto {
margin-left: 0!important;
}
@media(min-width: 576px) {
.card-group>.card:first-child {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem;
}
.card-group>.card:not(:first-child):not(:last-child):not(:only-child) {
border-radius: .25rem;
}
.card-group>.card:last-child {
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem;
}
}
}