-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbrowsers.php
More file actions
178 lines (139 loc) · 5.45 KB
/
browsers.php
File metadata and controls
178 lines (139 loc) · 5.45 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
//Getting autoload from composer
include 'vendor/autoload.php';
//Declaring classes to use in the script
use Alexschwarz89\Browserstack\Screenshots\Api;
// Default values for BrowserSlack
const BROWSERSTACK_ACCOUNT = '';
const BROWSERSTACK_PASSWORD = '';
//Creating new API object
$api = new Api(BROWSERSTACK_ACCOUNT, BROWSERSTACK_PASSWORD);
?>
<html lang="en">
<head>
<meta charset="utf-8">
<title>BrowserStack @Waracle.net</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="assert/bootstrap.css" media="screen">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a href="../" class="navbar-brand">BrowserStack @Waracle.net</a>
</div>
</div>
</div>
<div class="container" ng-app="browserApp" ng-controller="mainController">
<div class="file-date alert alert-success">
<?php
// JSON file
$fileJ = 'browsers.json';
// Open the file to get existing content
$openF = fopen($fileJ,"w");
//JSON variable with all devices
$browserList = $api->getBrowsers();
//Returns the JSON representation of a value
$browserList = json_encode($browserList);
// Write the contents back to the file
fwrite($openF, $browserList);
fclose($openF);
if (file_exists($fileJ)) {
echo "<center>Browser.json was updated : <strong>" . date ("d F Y H:i", filemtime($fileJ)) . "</strong></center>";
}
?>
</div>
<div class="page-header" id="banner">
<div class="form-browser">
<form>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-search"></i></div>
<input type="text" class="form-control" placeholder="Type your search" ng-model="searchBrowser">
</div>
</div>
</form>
</div>
<table class="browser-table table table-bordered table-striped">
<thead>
<tr>
<td>
<a href="#" ng-click="sortType = 'os'; sortReverse = !sortReverse">
Operating system
<span ng-show="sortType == 'os' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'os' && sortReverse" class="fa fa-caret-up"></span>
</a>
</td>
<td>
<a href="#" ng-click="sortType = 'os_version'; sortReverse = !sortReverse">
Operating system version
<span ng-show="sortType == 'os_version' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'os_version' && sortReverse" class="fa fa-caret-up"></span>
</a>
</td>
<td>
<a href="#" ng-click="sortType = 'device'; sortReverse = !sortReverse">
Device
<span ng-show="sortType == 'device' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'device' && sortReverse" class="fa fa-caret-up"></span>
</a>
</td>
<td>
<a href="#" ng-click="sortType = 'browser'; sortReverse = !sortReverse">
Browser
<span ng-show="sortType == 'browser' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'browser' && sortReverse" class="fa fa-caret-up"></span>
</a>
</td>
<td>
<a href="#" ng-click="sortType = 'browser_version'; sortReverse = !sortReverse">
Browser version
<span ng-show="sortType == 'browser_version' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'browser_version' && sortReverse" class="fa fa-caret-up"></span>
</a>
</td>
</tr>
</thead>
<tbody>
<tr class="{{item.os}}" ng-repeat="item in browsers | orderBy:sortType:sortReverse | filter:searchBrowser">
<td>{{ item.os }}</td>
<td>{{ item.os_version }}</td>
<td>{{ item.device }}</td>
<td>{{ item.browser }}</td>
<td>{{ item.browser_version }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<footer>
<div class="footer-bottom">
BrowserStack JSON with AngularJS (Waracle.net)
</div>
</footer>
</body>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
</html>
<script type="text/javascript">
angular.module('browserApp', [])
.controller('mainController', function($scope, $http) {
$scope.sortType = 'name'; // set the default sort type
$scope.sortReverse = false; // set the default sort order
$scope.searchBrowser = ''; // set the default search/filter term
//Getting the browser JSON file
$http.get('browsers.json', {cache: true}).success(function(data) {
//Converting from string to integer.
for (var i = data.length - 1; i >= 0; i--) {
if (data[i].browser_version != null){
var pos = data[i];
pos["browser_version"] = parseInt(data[i].browser_version);
}
};
$scope.browsers = data;
});
});
</script>
<script type="text/javascript">
</script>