Changeset 2964754
- Timestamp:
- 09/09/2023 12:13:07 PM (2 years ago)
- Location:
- eh-gms-feed
- Files:
-
- 10 edited
-
tags/3.5/css/gms-default.css (modified) (1 diff)
-
tags/3.5/eh-gms-feed.php (modified) (1 diff)
-
tags/3.5/includes/main-class.php (modified) (5 diffs)
-
tags/3.5/js/eh-gms-feed.js (modified) (5 diffs)
-
tags/3.5/readme.txt (modified) (2 diffs)
-
trunk/css/gms-default.css (modified) (1 diff)
-
trunk/eh-gms-feed.php (modified) (1 diff)
-
trunk/includes/main-class.php (modified) (5 diffs)
-
trunk/js/eh-gms-feed.js (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eh-gms-feed/tags/3.5/css/gms-default.css
r2948451 r2964754 5 5 .gms-footnote, .gms-filter { margin: 0 0 2rem } 6 6 .gms-clubteam { font-weight: 700 } 7 .gms-clubteam[data-team] { cursor: pointer }8 7 .gms-filter > div { margin: 0 0 1rem } 9 8 .gms-filter fieldset { width: fit-content } -
eh-gms-feed/tags/3.5/eh-gms-feed.php
r2958570 r2964754 4 4 * Plugin URI: https://wordpress.org/plugins/eh-gms-feed/ 5 5 * Description: Show fixtures, results and tables from England Hockey GMS 6 * Version: 3. 46 * Version: 3.5 7 7 * Author: Matthew Treherne 8 8 * Author URI: https://profiles.wordpress.org/mtreherne -
eh-gms-feed/tags/3.5/includes/main-class.php
r2958570 r2964754 38 38 $html = '<div'.(($comp_count == 0) ? ' style="display: none" ': '').'><label><span class="gms-nomobile">Competition </span><select name="comp_id"><option value="">- All Competitions -</option>'; 39 39 foreach ($this->team_comps as $key => $competition) $html .= '<option value="'.$key.'"'.(($this->is_competition() && $this->atts_show['comp_id'] == $key) || ($comp_count == 1) ? ' selected' : '').'>'.esc_html($competition['name']).'</option>'; 40 if ($this->is_competition() && !array_key_exists($this->atts_show['comp_id'], $this->team_comps)) { 41 $html .= '<option value="'.$this->atts_show['comp_id'].'" selected>Previous Season</option>'; 42 } 40 43 $html .= '</select></label></div>'; 41 44 return $html; … … 95 98 else { 96 99 $valid_json = false; 97 $message = sprintf(esc_html__( 'No %s data could be found.', 'eh-gms-feed' ), $this->api[$key]['suffix'] ?? $key); 100 $data_type = $this->api[$key]['suffix'] ?? $key; 101 switch ($data_type) { 102 case 'table' : $data_type = 'league'; break; 103 case 'fixturesandresults' : $data_type = 'results/fixtures'; break; 104 } 105 $message = sprintf(esc_html__( 'No %s data could be found.', 'eh-gms-feed' ), $data_type); 98 106 } 99 107 } … … 142 150 $filter = false; 143 151 if (is_numeric($this->atts_show['whatson'])) { 144 $diff = (new \DateTime())->diff($fixture_date)->format('%a'); 152 $compare = (clone $fixture_date)->setTime(0,0); 153 $diff = (new \DateTime())->setTime(0,0)->diff($compare)->format('%a'); 145 154 if ($diff > $this->atts_show['whatson']) $filter = true; 146 155 } … … 357 366 private function process_teams ($data) { 358 367 $teams = []; 359 foreach ($data as $team) $teams[$team->id] = ['teamName' => $team->teamName, 'clubId' => $team->clubId, 'clubName' => $team->clubName, 'slug' => $team->entityUrlSlug, 'clubSlug' => $team->clubUrlSlug, 'gender' => $team->gender ];368 foreach ($data as $team) $teams[$team->id] = ['teamName' => $team->teamName, 'clubId' => $team->clubId, 'clubName' => $team->clubName, 'slug' => $team->entityUrlSlug, 'clubSlug' => $team->clubUrlSlug, 'gender' => $team->gender, 'clubLogoUrl' => $team->clubLogoUrl ?? null]; 360 369 return $teams; 361 370 } … … 478 487 479 488 public function enqueue_scripts () { 480 wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3. 4', true);489 wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3.5', true); 481 490 wp_localize_script('EH_GMS_Feed', 'eh_gms_feed_ajax_obj', ['ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce('get_gms_table')]); 482 wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3. 3');491 wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.5'); 483 492 if ($this->settings->default_css == 'yes') wp_enqueue_style('EH_GMS_Feed'); 484 493 } -
eh-gms-feed/tags/3.5/js/eh-gms-feed.js
r2958570 r2964754 8 8 9 9 function club_team (message, filter, wrapper) { 10 wrapper.find('.gms-clubteam[data-team]'). on('click', function(e) {10 wrapper.find('.gms-clubteam[data-team]').css('cursor','pointer').on('click', function(e) { 11 11 var team = e.currentTarget.dataset.team; 12 12 filter.find('select[name="team"]').val(team); 13 team_change(message, filter, wrapper, team, function() { filter.find('button').trigger('click'); }); 13 team_change(message, filter, wrapper, team, function() { 14 filter.find('select[name="whatson"]').val(''); 15 if (filter.find('select[name="comp_id"]').val() != '- All Competitions -' && filter.find('input[type="checkbox"][name="show"][value="results"]').prop('checked')) { 16 filter.find('input[type="checkbox"][name="show"][value="league"]').prop('checked',true); 17 } 18 filter.find('button').trigger('click'); 14 19 }); 20 }); 15 21 } 16 22 … … 24 30 if (comp_data[team] !== undefined) { 25 31 comp_div.replaceWith(comp_data[team]); 26 wrapper.html(refresh_message);27 32 if (callback) callback(); 28 33 } … … 36 41 comp_data[team] = data; 37 42 comp_div.replaceWith(data); 38 wrapper.html(refresh_message);39 43 if (callback) callback(); 40 44 }) … … 51 55 comp_field.html(comp_default); 52 56 whatson_default.text('- Next Match Day -'); 53 wrapper.html(refresh_message);57 filter.find('input[type="checkbox"][name="show"][value="league"]').prop('checked',false); 54 58 } 55 59 } … … 111 115 }); 112 116 }); 117 filter.on('change', function(e) { 118 ele.html(refresh_message); 119 }); 113 120 club_team(message, filter, ele); 114 121 } -
eh-gms-feed/tags/3.5/readme.txt
r2958570 r2964754 5 5 Tested up to: 6.2 6 6 Requires PHP: 5.3 7 Stable tag: 3. 47 Stable tag: 3.5 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 63 63 == Changelog == 64 64 65 = 3.5 = 66 * Deal with previous season competition in dynamic filter 67 * Tweak to whatson calculation 68 * Clicking on club team will show league with results and default whatson 69 * Uncheck league when all club teams selected 70 * Tweak to messages when no data found and when filter changed 71 * Change to default CSS for gms-clubteam 72 65 73 = 3.4 = 66 74 * Show gender option for club teams -
eh-gms-feed/trunk/css/gms-default.css
r2948451 r2964754 5 5 .gms-footnote, .gms-filter { margin: 0 0 2rem } 6 6 .gms-clubteam { font-weight: 700 } 7 .gms-clubteam[data-team] { cursor: pointer }8 7 .gms-filter > div { margin: 0 0 1rem } 9 8 .gms-filter fieldset { width: fit-content } -
eh-gms-feed/trunk/eh-gms-feed.php
r2958570 r2964754 4 4 * Plugin URI: https://wordpress.org/plugins/eh-gms-feed/ 5 5 * Description: Show fixtures, results and tables from England Hockey GMS 6 * Version: 3. 46 * Version: 3.5 7 7 * Author: Matthew Treherne 8 8 * Author URI: https://profiles.wordpress.org/mtreherne -
eh-gms-feed/trunk/includes/main-class.php
r2958570 r2964754 38 38 $html = '<div'.(($comp_count == 0) ? ' style="display: none" ': '').'><label><span class="gms-nomobile">Competition </span><select name="comp_id"><option value="">- All Competitions -</option>'; 39 39 foreach ($this->team_comps as $key => $competition) $html .= '<option value="'.$key.'"'.(($this->is_competition() && $this->atts_show['comp_id'] == $key) || ($comp_count == 1) ? ' selected' : '').'>'.esc_html($competition['name']).'</option>'; 40 if ($this->is_competition() && !array_key_exists($this->atts_show['comp_id'], $this->team_comps)) { 41 $html .= '<option value="'.$this->atts_show['comp_id'].'" selected>Previous Season</option>'; 42 } 40 43 $html .= '</select></label></div>'; 41 44 return $html; … … 95 98 else { 96 99 $valid_json = false; 97 $message = sprintf(esc_html__( 'No %s data could be found.', 'eh-gms-feed' ), $this->api[$key]['suffix'] ?? $key); 100 $data_type = $this->api[$key]['suffix'] ?? $key; 101 switch ($data_type) { 102 case 'table' : $data_type = 'league'; break; 103 case 'fixturesandresults' : $data_type = 'results/fixtures'; break; 104 } 105 $message = sprintf(esc_html__( 'No %s data could be found.', 'eh-gms-feed' ), $data_type); 98 106 } 99 107 } … … 142 150 $filter = false; 143 151 if (is_numeric($this->atts_show['whatson'])) { 144 $diff = (new \DateTime())->diff($fixture_date)->format('%a'); 152 $compare = (clone $fixture_date)->setTime(0,0); 153 $diff = (new \DateTime())->setTime(0,0)->diff($compare)->format('%a'); 145 154 if ($diff > $this->atts_show['whatson']) $filter = true; 146 155 } … … 357 366 private function process_teams ($data) { 358 367 $teams = []; 359 foreach ($data as $team) $teams[$team->id] = ['teamName' => $team->teamName, 'clubId' => $team->clubId, 'clubName' => $team->clubName, 'slug' => $team->entityUrlSlug, 'clubSlug' => $team->clubUrlSlug, 'gender' => $team->gender ];368 foreach ($data as $team) $teams[$team->id] = ['teamName' => $team->teamName, 'clubId' => $team->clubId, 'clubName' => $team->clubName, 'slug' => $team->entityUrlSlug, 'clubSlug' => $team->clubUrlSlug, 'gender' => $team->gender, 'clubLogoUrl' => $team->clubLogoUrl ?? null]; 360 369 return $teams; 361 370 } … … 478 487 479 488 public function enqueue_scripts () { 480 wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3. 4', true);489 wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3.5', true); 481 490 wp_localize_script('EH_GMS_Feed', 'eh_gms_feed_ajax_obj', ['ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce('get_gms_table')]); 482 wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3. 3');491 wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.5'); 483 492 if ($this->settings->default_css == 'yes') wp_enqueue_style('EH_GMS_Feed'); 484 493 } -
eh-gms-feed/trunk/js/eh-gms-feed.js
r2958570 r2964754 8 8 9 9 function club_team (message, filter, wrapper) { 10 wrapper.find('.gms-clubteam[data-team]'). on('click', function(e) {10 wrapper.find('.gms-clubteam[data-team]').css('cursor','pointer').on('click', function(e) { 11 11 var team = e.currentTarget.dataset.team; 12 12 filter.find('select[name="team"]').val(team); 13 team_change(message, filter, wrapper, team, function() { filter.find('button').trigger('click'); }); 13 team_change(message, filter, wrapper, team, function() { 14 filter.find('select[name="whatson"]').val(''); 15 if (filter.find('select[name="comp_id"]').val() != '- All Competitions -' && filter.find('input[type="checkbox"][name="show"][value="results"]').prop('checked')) { 16 filter.find('input[type="checkbox"][name="show"][value="league"]').prop('checked',true); 17 } 18 filter.find('button').trigger('click'); 14 19 }); 20 }); 15 21 } 16 22 … … 24 30 if (comp_data[team] !== undefined) { 25 31 comp_div.replaceWith(comp_data[team]); 26 wrapper.html(refresh_message);27 32 if (callback) callback(); 28 33 } … … 36 41 comp_data[team] = data; 37 42 comp_div.replaceWith(data); 38 wrapper.html(refresh_message);39 43 if (callback) callback(); 40 44 }) … … 51 55 comp_field.html(comp_default); 52 56 whatson_default.text('- Next Match Day -'); 53 wrapper.html(refresh_message);57 filter.find('input[type="checkbox"][name="show"][value="league"]').prop('checked',false); 54 58 } 55 59 } … … 111 115 }); 112 116 }); 117 filter.on('change', function(e) { 118 ele.html(refresh_message); 119 }); 113 120 club_team(message, filter, ele); 114 121 } -
eh-gms-feed/trunk/readme.txt
r2958570 r2964754 5 5 Tested up to: 6.2 6 6 Requires PHP: 5.3 7 Stable tag: 3. 47 Stable tag: 3.5 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 63 63 == Changelog == 64 64 65 = 3.5 = 66 * Deal with previous season competition in dynamic filter 67 * Tweak to whatson calculation 68 * Clicking on club team will show league with results and default whatson 69 * Uncheck league when all club teams selected 70 * Tweak to messages when no data found and when filter changed 71 * Change to default CSS for gms-clubteam 72 65 73 = 3.4 = 66 74 * Show gender option for club teams
Note: See TracChangeset
for help on using the changeset viewer.