mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 14:56:53 +00:00
Fix CLA to get code piece of QS. Closes #2067
This commit is contained in:
parent
d69ecd8102
commit
2615bf9547
@ -418,15 +418,21 @@ footer: true
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function qs(key) {
|
||||||
|
key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
|
||||||
|
var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
|
||||||
|
return match && decodeURIComponent(match[1].replace(/\+/g, " "));
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
populateCountries("country", "region");
|
populateCountries("country", "region");
|
||||||
var spinner = new Spinner().spin(document.getElementById('spinner'));
|
var spinner = new Spinner().spin(document.getElementById('spinner'));
|
||||||
var codeCheck = window.location.href.match(/\?code=(.*)/);
|
var codeCheck = qs('code');
|
||||||
if (codeCheck && codeCheck.length > 0) {
|
if (codeCheck && codeCheck.length > 0) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "https://cla.home-assistant.io/github/exchange",
|
url: "https://cla.home-assistant.io/github/exchange",
|
||||||
data: JSON.stringify({"code": codeCheck[1]}),
|
data: JSON.stringify({"code": codeCheck}),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
}).done(function(data){
|
}).done(function(data){
|
||||||
var uri = window.location.toString();
|
var uri = window.location.toString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user