JavaScript Game Select

  • Hello Guest! Welcome to ConsoleCrunch, to help support our site check out the premium upgrades HERE! to get exclusive access to our hidden content.
  • Unable to load portions of the website...
    If you use an ad blocker addon, you should disable it because it interferes with several elements of the site and blocks more than just adverts.
  • Read Rules Before Posting Post Virus Scans with every program.

PliskinDev

Avid Poster
CC Dev Team
Determined Poster
Active Member
Console ID Poster
Jun 19, 2019
322
788
153
Minnesota
-----------------------------------------------



javascript.png




----------------------------------------


[hide-reply][/hide-reply]
[hide-reply]
var NFIGDB = window.NFIGDB || {};

!function($, window, document, _undefined)
{
"use strict";

NFIGDB.GameSelect = XF.Element.newHandler({

options: {
platforms: true,
showFaves: true
},

init: function()
{
function formatGame (game) {
if (!game.id) {
return game.text;
}
var $game = $(
'<span><img src="' + game.cover + '" style="height:auto;width:40px;" /> ' + game.text + '</span>'
);
return $game;
};

var showFaves = this.options.showFaves;

this.$target.select2({
ajax: {
url: XF.canonicalizeUrl('index.php?igdb/search.json'),
delay: 750,
data: function (params) {
var query = {
term: params.term,
faves: showFaves,
_xfToken: XF.config.csrf
}
return query;
},
processResults: function (data) {
return {
results: data.results
};
},
cache: true
},
placeholder: 'Search for a game',
allowClear: true,
//templateResult: formatGame
//minimumInputLength: 1
});

if (this.$target.data('platform-picker'))
{
var rows = this.$target.data('rows')
var admin = this.$target.data('admin')
var noGroups = this.$target.data('no-groups')

this.$target.on('select2:select', function (e) {
var data = e.params.data;
var gameId = data.id;
if (gameId == 0)
{
return;
}

XF.ajax('get', XF.canonicalizeUrl('index.php?igdb/platforms'), {'game_id': gameId, 'rows': rows, 'admin': admin, 'no_groups': noGroups}, function (data) {
XF.setupHtmlInsert(data.html, function($html, container, onComplete)
{
$('.formHiderTarget').replaceWith($html);
});
})
});
}
}
});

XF.Element.register('game-select', 'NFIGDB.GameSelect');
}
(jQuery, window, document);
[/hide-reply]


-----------------------------------------

 
General chit-chat
Help Users
  • @ lurch6661:
    lol
  • @ QM|T_JinX:
    cool bro
  • @ QM|T_JinX:
    so its going good huh
  • @ lurch6661:
    as long as she dont have a bambino
  • @ lurch6661:
    lol
  • @ QM|T_JinX:
    lol
  • @ lurch6661:
    we shall see
  • @ lurch6661:
    lol
  • @ lurch6661:
    i can hear the baby lurch
  • @ lurch6661:
    now
  • @ QM|T_JinX:
    omg
  • @ lurch6661:
    kidding bro
  • @ QM|T_JinX:
    i know haha
  • @ lurch6661:
    iam to old for that
  • @ QM|T_JinX:
    who knows
  • @ lurch6661:
    by the time baby lurch is 18 ill be pushing daiseys
  • @ QM|T_JinX:
    lol
  • @ lurch6661:
    poor lurch we knew him well
  • @ lurch6661:
    lol
  • @ lurch6661:
    evryone here says i care for nothing except gf lol
  • @ QM|T_JinX:
    lol
  • @ lurch6661:
    with the profits of my music career i will move mountains lol
  • @ lurch6661:
    10 cents per cd
  • @ QM|T_JinX:
    hahahhaha
      @ QM|T_JinX: hahahhaha