Krasnogorsk WebCams
by vitalsone
HTML
<script src="https://code.angularjs.org/1.0.1/angular-1.0.1.js"></script>
<!--
Плагин для Chrome:
https://chrome.google.com/webstore/detail/play-hls-m3u8/ckblfoghkjhaclegefojbgllenffajdc
-->
<div ng-controller="MyCtrl">
<div ng-hide="isLoaded">
Загрузка ...
</div>
<ul>
<li ng-repeat="cam in cameras.cameras">
<a href="{{cam.sd_stream_url}}" target="_blank">{{cam.title}}</a>
</li>
</ul>
</div>
CSS
@import url('https://fonts.googleapis.com/css?family=Roboto');
body {padding:15px; font-family: 'Roboto', sans-serif; font-size:14px; color: #888}
ul {margin:0; padding:0 0 0 15px}
li {list-style-type:decimal; padding:0 0 0 3px}
a,a:visited,a:active {color:#003EEE}
a:hover {color:red;}
JavaScript
var myApp = angular.module('myApp',[]);
function MyCtrl($scope, $http) {
$http({method: "GET", url: "https://cors-anywhere.herokuapp.com/http://tv.ipls.ru/json_api/list_cameras.php?r=" + (Math.floor(Math.random() * Math.floor(1000000000)))})
.then(
function success(resp) {
$scope.isLoaded = true;
$scope.cameras = resp.data;
},
function error(resp){
alert("some error");
console.log(resp);
}
);
}