Created
December 4, 2017 06:36
-
-
Save ermst4r/d0e90e8ef7108c7679252fa99d58a8cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); | |
} | |
}); | |
} | |
} |
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());
Zoeken jullie nog freelancers 🥇
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kijk even wat jquery export voor zover mijn ervaring geen $
import * as $ from 'jquery';
Simpel test of dit is gelukt
$(function () {
console.log('Hello jQuery');
});