-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-2.html
133 lines (98 loc) · 5.74 KB
/
build-2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<link href='https://fonts.googleapis.com/css?family=Chivo:900' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="javascripts/oauth.js" type="text/javascript"></script>
<script src="javascripts/mustache.js" type="text/javascript"></script>
<script src="javascripts/utilities.js" type="text/javascript"></script>
<script src="javascripts/tabletop.js" type="text/javascript"></script>
<script src="javascripts/underscore-min.js" type="text/javascript"></script>
<script src="javascripts/base64.js" type="text/javascript"></script>
<script src="javascripts/github.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>Simple API</title>
</head>
<body>
<div id="container">
<div class="inner">
<header>
<h1><a href="index.html">Simple API</a></h1>
<h2>This is a simple API. <a href="about.html">Learn more...</a></h2>
</header>
<section id="main_content">
<h1>Forking API Repository</h1>
<p>The API repository is now being forked under your account / organization.</p>
<p align="center"><img src="https://s3.amazonaws.com/kinlane-productions/loading.gif" id="loading" width="150" /></p>
<script type="text/javascript">
function callback(url){
return function(){
location.href=url;
}
}
$UserLogin = getUrlVar('account');
$repo = getUrlVar('repo');
$cleanrepo = $repo.replace("api-","");
$oAuth_Token = getUrlVar('oAuth_Token');
var github = new Github({
token: $oAuth_Token,
auth: "oauth"
});
var repo = github.getRepo('simple-api', 'central');
var $Manifest = "";
var $User = "";
// Getting manifest
repo.read('gh-pages','manifest.json',function(err, data){
$Manifest = jQuery.parseJSON(data);
$Exists = 0;
$.each($Manifest, function(s, $EachManifest) {
if($EachManifest['account'] == $UserLogin && $EachManifest['template'] == $repo){
$Exists = 1;
}
});
$AddManifest = {};
$AddManifest['account'] = $UserLogin;
$AddManifest['template'] = $repo;
if($Exists==0)
{
$Manifest.push($AddManifest);
}
$$ManifestJSON = JSON.stringify($Manifest);
$$ManifestJSON = JSON.stringify(JSON.parse($$ManifestJSON),null,2);
repo.write('gh-pages','manifest.json', $$ManifestJSON, 'Saving maniest after update!', function(err) {
if(err){
if(err['error']=='404'){
$("#displayMe").append('<br /><center>Sorry, you do not have permission!</center>');
document.getElementById("loading").style.display = 'none';
}
}
else{
var repo = github.getRepo('simple-api', $repo);
repo.fork(function(err) {
//$("#displayMe").append("forking " + $repo + "<br />");
redirectURL = "http://simple-api.github.io/central/build-3.html?repo=" + $repo + "&oAuth_Token=" + $oAuth_Token + "&account=" + $UserLogin;
setTimeout(callback(redirectURL), 5000);
});
}
});
});
</script>
<div id="displayMe"></div>
</section>
<footer>
Simple-api is maintained by <a href="https://github.com/simple-api">simple-api</a><br>
This page was generated by <a href="http://pages.github.com">GitHub Pages</a>. Tactile theme by <a href="https://twitter.com/jasonlong">Jason Long</a>.
</footer>
</div>
</div>
</body>
</html>