Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pieter-groeneweg authored Jun 29, 2018
1 parent cdf05da commit 6e8faa2
Show file tree
Hide file tree
Showing 9 changed files with 392 additions and 0 deletions.
138 changes: 138 additions & 0 deletions css/live_scorer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@

/* For desktop: */

.lsw-col-1 {width: 8.33%;}
.lsw-col-2 {width: 16.66%;}
.lsw-col-3 {width: 25%;}
.lsw-col-4 {width: 33.33%;}
.lsw-col-5 {width: 41.66%;}
.lsw-col-6 {width: 50%;}
.lsw-col-7 {width: 58.33%;}
.lsw-col-8 {width: 66.66%;}
.lsw-col-9 {width: 75%;}
.lsw-col-10 {width: 83.33%;}
.lsw-col-11 {width: 91.66%;}
.lsw-col-12 {width: 100%;}

@media only screen and (max-width: 768px) {
/* For mobile phones: */
[class*="lsw-col-"] {
width: 100%;
}
}
.lsw_outer_div{
padding: 0px;
border: 2px solid #f3f3f3;
margin: 3px;
}
.lsw_outer_div .clearfix{
clear:both;
}

.lsw-footer{
border: 1px solid #f3f3f3;
background-color: #f3f3f3;
font-family: Roboto,Arial,"Helvetica Neue",Helvetica,sans-serif;
}
.lsw-header{
border: 1px solid #1F3967;
background-color: #1F3967;
color:#FFFFFF;
text-align: center;
font-family: Roboto,Arial,"Helvetica Neue",Helvetica,sans-serif;
min-height: 50px;
padding: 5px ;
min-height: 60px ;
}

.lsw-live-btn{
background-color: #DE3B4B; /* Green */
border: none;
color: white;
padding: 0px 5px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 2px;
}

@media only screen and (min-width: 600px) {
/* For tablets: */
.lsw-col-s-1 {width: 8.33%;}
.lsw-col-s-2 {width: 16.66%;}
.lsw-col-s-3 {width: 33.33%;}
.lsw-col-s-4 {width: 33.33%;}
.lsw-col-s-5 {width: 41.66%;}
.lsw-col-s-6 {width: 50%;}
.lsw-col-s-7 {width: 58.33%;}
.lsw-col-s-8 {width: 66.66%;}
.lsw-col-s-9 {width: 75%;}
.lsw-col-s-10 {width: 83.33%;}
.lsw-col-s-11 {width: 91.66%;}
.lsw-col-s-12 {width: 100%;}
}
/* new section added to force 4 wide at 992 px */
@media only screen and (min-width: 992px) {
/* For tablets: */
.lsw-col-s-1 {width: 8.33%;}
.lsw-col-s-2 {width: 16.66%;}
.lsw-col-s-3 {width: 25%;}
.lsw-col-s-4 {width: 33.33%;}
.lsw-col-s-5 {width: 41.66%;}
.lsw-col-s-6 {width: 50%;}
.lsw-col-s-7 {width: 58.33%;}
.lsw-col-s-8 {width: 66.66%;}
.lsw-col-s-9 {width: 75%;}
.lsw-col-s-10 {width: 83.33%;}
.lsw-col-s-11 {width: 91.66%;}
.lsw-col-s-12 {width: 100%;}

}



.lsw-right{
float:right;
}
.lsw-left{
float:left;
}

.lsw-body{
font-family: Roboto,Arial,"Helvetica Neue",Helvetica,sans-serif;
font-size: 15px;
text-align:center;
margin-top: 10px;
min-height: 160px;
}
@media only screen and (max-width: 599px) {
.lsw-body{
min-height: 10px;
}
}
@media only screen and (min-width: 600px) {
.lsw-body{
min-height: 185px;
}
}
@media only screen and (min-width: 992px) {
.lsw-score-section{
margin:15px;
}
}
@media only screen and (max-width: 991px) {
.lsw-score-section{
margin:10px;
}
}

.lsw-scorecard{
text-decoration:none;
padding: 0px 0px;
margin: 4px 2px;
color:#1F3967;
font-weight: lighter;
}
25 changes: 25 additions & 0 deletions helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
*/
class modPlaycricketHelper
{
/**
*/
public static function getScript($params)
{

$myClubId = $params->get('myClubId', '');

$modid = $params->get('modid', '1');
$sfx = $params->get('moduleclass_sfx');

$result = '<a style="display:none;" class="lsw" href="https://www.play-cricket.com/embed_widget/live_scorer_widgets?club_id='.$myClubId.'" id="lsw_link_1526534855798"></a>';
$result.= '<div class="lsw-col-12 lsw_tile" id="lsw_container_1526534855798"></div>';


return $result;
}
}
?>
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
122 changes: 122 additions & 0 deletions js/live_scorer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//http://derbyscountylge.new_uat-ecbplay-cricket.com:3000/website/third_party_widgets/live_scorer
var lsw_reference;
jQueryCode = function(){
// your jQuery code
loadScoreView();
}

if(window.jQuery){
jQueryCode();
} else{
var script = document.createElement('script');
document.head.appendChild(script);
script.type = 'text/javascript';
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js";
script.onload = jQueryCode;
}

function loadScoreView() {
//console.log(typeof jQuery == 'undefined')
jQuery( ".lsw" ).each(function(index, value ) {
var id = value.id.slice(9);
var arr = value.href.split("/")
var domain = arr[0] + "//" + arr[2]
jQuery.ajax({
type: 'GET',
url: value.href,
dataType: "json",
success: function(data){
if (data.matches.length > 0){
buildLiveScorerView(id, data,domain)
if (lsw_reference == undefined){
lsw_reference = setInterval(function () { updateLiveScorerView(); }, 180000);
}
}
}
});
});
}

function buildLiveScorerView(div_id, data, domain){
//console.log(data)
jQuery("#lsw_container_"+div_id).html("")
jQuery.each(data.matches, function( index, value ) {
//console.log(value)
str=""
str+="<div class='lsw-col-3 lsw-col-s-3 lsw-left'>"
str+="<div class='lsw_outer_div'>"
str+="<div class='lsw-col-12'>"
str+="<div class='lsw-header'>"
if(value.competition_type == "Friendly"){
str+="Friendly"+"-"
}else{
if (value.league_name == ""){
str+=value.competition_name
}else{
str+="<div>"+value.league_name+"</div>"
str+="<div>"+value.competition_name+"</div>"
}
}
str+="</div>"
str+="</div>"
str+="<div class='lsw-col-12'>"
str+="<div class='lsw-body'>"
str+="<div>"+value.home_club_name+" "+value.home_team_name+"</div>"
str+="<div class='lsw-score-section'>"
str+="<div>"+value.home_team_score
if(value.home_team_id == value.toss_won_by_team_id){
str+="<img src="+domain+"/coin.png height='20' width='20'>"
}
if(value.home_team_id == value.batted_first){
str+="<img src="+domain+"/batball.png height='20' width='20'>"
}
str+="</div>"
str+="</div>"

str+="<div>"+value.away_club_name+" "+value.away_team_name+"</div>"
str+="<div class='lsw-score-section'>"
str+="<div>"+value.away_team_score
if(value.away_team_id == value.toss_won_by_team_id){
str+="<img src="+domain+"/coin.png height='20' width='20'>"
}
if(value.away_team_id == value.batted_first){
str+="<img src="+domain+"/batball.png height='20' width='20'>"
}
str+="</div>"
str+="</div>"
str+="</div>"
str+="</div>"
str+="<div class='lsw-col-12'>"
str+="<div class='lsw-footer'><a href="+domain+"/website/results/"+value.fixture_id+" target='_blank'><div class='lsw-left lsw-scorecard'>Scorecard</div><div class='lsw-right lsw-live-btn'>Live</div><div class='clearfix'></div></a></div>"
//console.log(data.live_scorer_is_live)
if(!data.live_scorer_is_live){
var time = new Date();
str+="<div class='lsw-left'>Last Updated "+ (time.getHours() < 10 ? '0' : '') + time.getHours() + (time.getMinutes() < 10 ? ':0' : ':') + time.getMinutes()+"</div><div class='lsw-right' onClick='updateLiveScorerView();return false;'>Refresh</div>"
clearInterval(lsw_reference)
}
str+="</div>"
str+="<div class='clearfix'></div>"
str+="</div>"
str+="</div>"
jQuery("#lsw_container_"+div_id).append(str);
//console.log('ssss'+lsw_reference)
});
}

function updateLiveScorerView(){
jQuery( ".lsw" ).each(function(index, value ) {
var id = value.id.slice(9);
var arr = value.href.split("/")
var domain = arr[0] + "//" + arr[2]
jQuery.ajax({
type: 'GET',
url: value.href,
dataType: "json",
success: function(data){
buildLiveScorerView(id, data,domain)
}
});
});
}


4 changes: 4 additions & 0 deletions js/playcricketjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions mod_playcricket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
// Include the syndicate functions only once
require_once( dirname(__FILE__).'/helper.php' );

$playcricket = modPlaycricketHelper::getScript( $params );



require( JModuleHelper::getLayoutPath( 'mod_playcricket' ) );

?>
72 changes: 72 additions & 0 deletions mod_playcricket.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.8.10" client="site" method="upgrade">
<name>Play Cricket</name>
<author>Pieter Groeneweg</author>
<version>1.0.0</version>
<description>special play cricket development for bucksccc.org.uk</description>
<files>
<filename>mod_playcricket.xml</filename>
<filename module="mod_playcricket">mod_playcricket.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
<filename>js/playcricketjs.js</filename>
<filename>js/live_scorer.js</filename>
<filename>css/live_scorer.css</filename>
</files>
<config>

<fields name="params">
<fieldset name="basic">
<field name="myClubId" type="text" default="9195" label="Type Club ID" description="Type Club ID" />

</fieldset>
<fieldset
name="advanced">

<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />

<field
name="moduleclass_sfx"
type="text"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />

<field
name="cache"
type="list"
default="1"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC">
<option
value="1">JGLOBAL_USE_GLOBAL</option>
<option
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>

<field
name="cache_time"
type="text"
default="900"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />

<field
name="cachemode"
type="hidden"
default="static">
<option
value="static"></option>
</field>

</fieldset>

</fields>

</config>
</extension>
Loading

0 comments on commit 6e8faa2

Please sign in to comment.