• Resolved dtayl20

    (@dtayl20)


    Is there a way I can run a league where predictions are a win/loss prediction rather than predicting a score??

    ie tick a box for a win?

    Thanks again

    D

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author AntoineH

    (@antoineh)

    There is a “pick’em style” script that changes the layout to make players just pick the winner without entering scores.

    https://www.ads-software.com/support/topic/modify-latest-version-to-work-with-pick-em/

    It’s not ideal, but I think it still gets the job done. A better solution would be to create a new template via the available filters in PHP. But that would require quite a bit of coding, I think.

    The javascript needs to be added to your theme files or inserted via a plugin that allows you to enter custom javascript.

    Thread Starter dtayl20

    (@dtayl20)

    LOL. nice! Much better than the js I wrote!!

    Feature request. It would be nice if users could click on the flag as well as the team name to pick a winner

    Thanks again.

    Plugin Author AntoineH

    (@antoineh)

    I miss an easy way to determine the home or away team in the current version of the plugin when clicking the flag. Still doable, I guess, but I do not want to make the script too complex. So, can’t help you right away.

    I made a simple change in the template on my development version (added ‘home’ or ‘away’ class to the flag div). And that allowed me to make a simple adjustment to the script. I also removed the inline style and added a toggle for a ‘team-selected’ class that one could use to style the selected team (name and flag). The below script can be used when I release my new version of the plugin.

    /**
     * Pick'em style predictions
     * =========================
     * Compatible with flex layout and click support on flag in v2.11.0 and above.
     * Use CSS class 'team-selected' to style the selected team.
     */
    
    jQuery( document ).ready( function() {
    	jQuery( '.matchinfo.input.new-layout div' ).filter( function() {
    		$this = jQuery( this );
    		return $this.attr( 'id' ) && $this.attr( 'id' ).substr( 0, 5 ) === 'match';
    	} )
    	.each( function() {
    		jQuery( 'div.score', this ).each( function( index ) {
    			$this = jQuery( this );
    			value = $this.text().replace( /\s/g, '' );
    			if ( value === '' && $this.children().length > 0 ) {
    				// the match is editable, so we hide the inputs and bind a click event
    				$this.siblings( '.home, .away, .flag' )
    					.css( 'cursor', 'pointer' )
    					.bind( 'click', function() {
    						$this = jQuery( this );
    						team = $this.hasClass( 'home' ) ? 'home' : 'away'; // home or away
    						$this.siblings( '.score' ).find( 'input[name^="_' + team + '"]' ).val( '1' );
    						$this.siblings( '.score' ).find( ':not(input[name^="_' + team + '"])' ).val( '0' );
    						$this.toggleClass( 'team-selected', true );
    						$this.siblings( '.' + team ).toggleClass( 'team-selected', true );
    						$this.siblings( ':not(.' + team + ')' ).toggleClass( 'team-selected', false );
    					} );
    
    				value = jQuery( 'input', this ).val();
    			}
    
    			selector = ( index === 0 ) ? '.home' : '.away';
    			if ( value === '1' ) {
    				$this.siblings( selector ).toggleClass( 'team-selected', true );
    			}
    			
    			$this.hide();
    		} );
    	} );
    
    	jQuery( '.matchinfo.input.new-layout' ).show();
    } );
    Thread Starter dtayl20

    (@dtayl20)

    ooh very nice.

    I added home and away selectors, added some styling and it all looked great. The flag div background would highlight but it won’t save. It will only save if the team name is clicked. Maybe I didn’t add the selectors in the right places.

    I might wait until your new release.

    Our national football seasons begin very soon.

    Any idea when you will make the new release??

    Thanks again!

    Plugin Author AntoineH

    (@antoineh)

    Any idea when you will make the new release??

    1-2 months from now. Depends a bit on how much time I can free up for testing.

    Is there a way to make this possible now? I want to do this and if you add i’ll be fantastic.

    Plugin Author AntoineH

    (@antoineh)

    You can use the script mentioned above. The latest version of the plugin has the correct classes that it targets.

    Thanks. I need to learn how add this code to the plugin and use the ‘team-selected’?. Great job!

    Hi, tried the above srcipt but keep getting critical error

    2023-09-10T13:08:35+00:00 CRITICAL syntax error, unexpected ‘)’, expecting variable (T_VARIABLE) in /home/sites/6b/5/52b1124f08/public_html/wp-content/themes/pickems/functions.php on line 20 2023-09-10T13:08:37+00:00 CRITICAL syntax error, unexpected ‘)’, expecting variable (T_VARIABLE) in /home/sites/6b/5/52b1124f08/public_html/wp-content/themes/pickems/functions.php on line 20 2023-09-10T13:08:40+00:00 CRITICAL syntax error, unexpected ‘)’, expecting variable (T_VARIABLE) in /home/sites/6b/5/52b1124f08/public_html/wp-content/themes/pickems/functions.php on line 20 2023-09-10T13:08:40+00:00 CRITICAL syntax error, unexpected ‘)’, expecting variable (T_VARIABLE) in /home/sites/6b/5/52b1124f08/public_html/wp-content/themes/pickems/functions.php on line 20 2023-09-10T13:09:00+00:00 CRITICAL syntax error, unexpected ‘)’, expecting variable (T_VARIABLE) in /home/sites/6b/5/52b1124f08/public_html/wp-content/themes/pickems/functions.php on line 20 2023-09-10T13:09:00+00:00 CRITICAL syntax error, unexpected ‘)’, expecting variable (T_VARIABLE) in /home/sites/6b/5/52b1124f08/public_html/wp-content/themes/pickems/functions.php on line 20 2023-09-10T13:10:48+00:00 CRITICAL syntax error, unexpected ‘)’, expecting variable (T_VARIABLE) in /home/sites/6b/5/52b1124f08/public_html/wp-content/themes/pickems/functions.php on line 61 2023-09-10T13:10:48+00:00 CRITICAL syntax error, unexpected ‘)’, expecting variable (T_VARIABLE) in /home/sites/6b/5/52b1124f08/public_html/wp-content/themes/pickems/functions.php on line 61

    Plugin Author AntoineH

    (@antoineh)

    The script is frontend code. You’ll have to load it between <script> tags or as part of een existing .js file.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Win/Loss Only’ is closed to new replies.