Skip to content

Instantly share code, notes, and snippets.

@ermst4r
Created December 4, 2017 06:36
Show Gist options
  • Save ermst4r/d0e90e8ef7108c7679252fa99d58a8cf to your computer and use it in GitHub Desktop.
Save ermst4r/d0e90e8ef7108c7679252fa99d58a8cf to your computer and use it in GitHub Desktop.
import $ from 'jquery';
import {settings} from './config';
export class Bid
{
constructor()
{
this.user_id = parseInt($('input[name=uuid]').val());
}
/**
* Fetch new seconds and a bid from theddddd
*/
sendBid(socket)
{
let user_id = parseInt($('input[name=uuid]').val());
/**
* Like button
*/
$(document).on('click','.btn-like',function () {
let aap_id = parseInt($(this).attr('data-aap_id'));
let profile_id = parseInt($(this).attr('data-profile'));
let is_inactive = $("#like-wrapper-"+aap_id).attr('class') === 'button-wrapper-inactive';
if(!is_inactive) {
$(this).addClass('profile-button-active').removeClass('profile-button-inactive');
socket.emit('send_bid',{
aap_id:aap_id,
profile_id:profile_id,
user_id:user_id,
bid_type:settings.bid_types.like
});
}
});
/**
* Heart button
*/
$(document).on('click','.btn-heart-red',function () {
let aap_id = parseInt($(this).attr('data-aap_id'));
let profile_id = parseInt($(this).attr('data-profile'));
let is_inactive = $("#heartwrapper-"+aap_id).attr('class') === 'button-wrapper-inactive';
if(!is_inactive) {
$(this).addClass('profile-button-active').removeClass('profile-button-inactive');
socket.emit('send_bid',{
aap_id:aap_id,
profile_id:profile_id,
user_id:user_id,
bid_type:settings.bid_types.heart
});
}
});
/**
* The golden heart
*/
$(document).on('click','.btn-heart-yellow',function () {
let aap_id = parseInt($(this).attr('data-aap_id'));
let profile_id = parseInt($(this).attr('data-profile'));
let is_inactive = $("#heartwrapper-"+aap_id).attr('class') === 'button-wrapper-inactive';
$(this).addClass('profile-button-active');
if(!is_inactive) {
socket.emit('send_bid',{
aap_id:aap_id,
profile_id:profile_id,
user_id:user_id,
bid_type:settings.bid_types.gold_heart
});
}
});
}
}
@yasinkocak
Copy link

Voor user_id moet dit beschikbaar zijn.

Dus
let user_id = null;

voor de

export class Bid {
}

Binnen de constructor zo is this.user_id beschikbaar

this.user_id = parseInt($('input[name=uuid]').val());

@yasinkocak
Copy link

Zoeken jullie nog freelancers 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment