123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>NoBall: Live cricket scores, news, and more!</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" type="text/css" href="desktop.css" media="screen and (min-aspect-ratio: 1/1)" />
- <link rel="stylesheet" type="text/css" href="mobile.css" media="screen and (max-aspect-ratio: 2147483646/2147483647)" />
- <link href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700,700i" rel="stylesheet">
- <style>body { margin: 0; border: 0; padding: 0; background-color: #b2df8a; line-height: 1.325 } a { color: inherit; text-decoration: inherit } *.matchEntry:hover { text-decoration: underline; }</style>
- <script>
- /*
- @licstart The following is the entire license notice for the
- JavaScript code in this page.
- Copyright (C) 2018 Muhammad M. Imtiaz
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or (at
- your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
- General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see https://www.gnu.org/licenses/.
- @licend The above is the entire license notice
- for the JavaScript code in this page.
- */
- </script>
- </head>
- <body style="font-family: 'PT Sans', sans-serif">
- <div id="topbar" style="width: 100%; height: 9.375vh; background-color: #009900; font-size: 7.0754716975vh; color: #fff"><img src="logo.png" style="max-height: 6.191037735vh; vertical-align: middle; display: inline-block" /><b>NoBall</b></div>
- <div id="topbar_bg"></div>
- <div class="scoreinfo">
- <div style="background-color: #a6cee3; color: #fff; font-size: 5.4759375vh; text-align: center"><b>MATCHES</b></div>
- <div id="scoreinfo" style="font-size: 2.73796875vh; background-color: #f7f7f7">
- <div id="noMatches" style="background-color: #f7f7f7">No matches at this time.</div>
- </div>
- </div>
- <div id="switch_view" style="font-size: 3.080214843vh; text-align: center; margin: auto;vertical-align: middle"><br /><b><span style="color: #404040" id="news_view">NEWS</span> | <a href="#" id="features_view" style="color: rgb(31, 120, 180)" onclick="document.getElementById('newsdiv').style.display = 'none'; document.getElementById('magazine').style.display = 'initial'; featuresView.parentNode.replaceChild(newsView, newsView_clicked); this.parentNode.replaceChild(featuresView_clicked, featuresView)">FEATURES</a></b></div>
- <div id="magazine"></div>
- <div id="newsdiv" style="background-color: #fff; height: 100%"></div>
- <script>
- newsView_clicked = document.getElementById('news_view');
- featuresView = document.getElementById('features_view');
- newsView = featuresView.cloneNode(false);
- newsView.id = "newsView";
- newsView.onclick = function() {
- document.getElementById('magazine').style.display = 'none';
- document.getElementById('newsdiv').style.display = 'block';
- newsView.parentNode.replaceChild(featuresView, featuresView_clicked);
- newsView.parentNode.replaceChild(newsView_clicked, newsView);
- }
- newsView.innerHTML = newsView_clicked.innerHTML;
- featuresView_clicked = newsView_clicked.cloneNode(false);
- featuresView_clicked.id = "featuresView";
- featuresView_clicked.innerHTML = featuresView.innerHTML;
- noMatches = document.getElementById('noMatches').cloneNode(true);
- matchSep = document.createElement("hr");
- matchSep.style.margin = "0";
- var newsRequest = new XMLHttpRequest();
- newsRequest.onload = function() {
- var jsonData = JSON.parse(newsRequest.responseText);
- var line = document.createElement('hr');
- line.className = 'news_separator';
- for(i = 0; i < jsonData.length; i++) {
- if(i > 0)
- document.getElementById('newsdiv').appendChild(line.cloneNode(false));
- var table = document.createElement('table');
- table.style.display = 'inline-block';
- table.style.margin = '0';
- table.style.padding = '2px';
- table.className = "newsitem";
- if(i == 0) {
- table.id = "first_news_item";
- }
- var link = document.createElement('a');
- link.href = jsonData[i].url;
- var imgLink = link.cloneNode(false);
- link.style.fontWeight = '700';
- link.appendChild(document.createTextNode(jsonData[i].title));
- table.appendChild(link);
- if(jsonData[i].image) {
- var imgLink = link.cloneNode(false);
- var img = document.createElement('img');
- img.src = jsonData[i].image;
- img.style.width = "100%";
- imgLink.appendChild(img);
- table.appendChild(imgLink);
- }
- document.getElementById('newsdiv').appendChild(table);
- }
- }
- newsRequest.open("GET", "news.json");
- newsRequest.send();
- var magRequest = new XMLHttpRequest();
- magRequest.onload = function() {
- var jsonData = JSON.parse(magRequest.responseText);
- for(i = 0; i < jsonData.length; i++) {
- var link = document.createElement('a');
- link.href = jsonData[i].url;
- link.onmouseover = function() { link.style.color = '#000'; }
- var div = document.createElement('div');
- if (i % 2 == 0) {
- div.style.backgroundColor = '#1f78b4';
- div.style.color = '#f7f7f7';
- }
- else {
- div.style.color = '#1f78b4';
- div.style.backgroundColor = '#f7f7f7';
- }
- div.style.width = '100%';
- if(jsonData[i].image) {
- var imgLink = link.cloneNode(false);
- var img = document.createElement('img');
- img.src = jsonData[i].image;
- img.style.width = '100%';
- img.style.margin = 'auto'
- img.style.display = 'inline-block';
- imgLink.appendChild(img);
- div.appendChild(imgLink);
- }
-
- titleLink = link.cloneNode(false);
- titleLink.style.display = 'block';
- titleLink.style.marginLeft = 'auto';
- titleLink.style.marginRight = 'auto';
- titleLink.style.width = '87.5%';
- titleLink.style.textAlign = 'center';
- titleLink.style.fontSize = '3.080214843vh';
- titleLink.style.fontWeight = '700';
- titleLink.appendChild(document.createTextNode(jsonData[i].title));
- div.appendChild(titleLink);
-
- descriptionLink = link.cloneNode(false);
- descriptionLink.style.fontSize = '2.310161133vh';
- descriptionLink.style.display = 'block';
- descriptionLink.style.marginLeft = '6.25%';
- descriptionLink.style.marginRight = '6.25%';
- descriptionLink.appendChild(document.createTextNode(jsonData[i].description));
- if(jsonData[i].author != "ESPNcricinfo staff") {
- descriptionLink.innerHTML += ". By ";
- authorName = document.createElement('b');
- authorName.appendChild(document.createTextNode(jsonData[i].author));
- descriptionLink.appendChild(authorName);
- }
-
- div.appendChild(descriptionLink);
- document.getElementById('magazine').appendChild(div);
- }
- }
- magRequest.open("GET", "magazine.json");
- magRequest.send();
- scoreInfoTable = document.getElementById('scoreinfo');
- var scoresRequest = new XMLHttpRequest();
- scoresRequest.onload = function() {
- children = null;
- while((children = scoreInfoTable.children).length > 0)
- scoreInfoTable.removeChild(children[0]);
- var jsonData = JSON.parse(scoresRequest.responseText);
- var line = document.createElement('hr');
- line.style.margin = '0';
- for(i = 0; i < jsonData.length; i++) {
- match = jsonData[i];
- if(match.status == '')
- continue;
- if(document.getElementsByClassName('matchEntry').length > 0)
- scoreInfoTable.appendChild(line.cloneNode(true));
- row = document.createElement("span");
- row.className = "matchEntry";
- row.style.display = 'block';
- entry = document.createElement("a");
- entry.href = match.url;
- entry.appendChild(document.createTextNode(match.status));
- row.appendChild(entry);
- scoreInfoTable.appendChild(row);
- }
- if(document.getElementsByClassName("matchEntry").length == 0)
- scoreInfoTable.appendChild(noMatches.cloneNode(true));
- }
- scoresRequest.open("GET", "scores.json?timestamp=" + new Date().getTime());
- scoresRequest.send();
- setInterval(function() { scoresRequest.open("GET", "scores.json?timestamp=" + new Date().getTime()); scoresRequest.send(); }, 20000);
- </script>
- </body>
- </html>
|