Skip to content

Instantly share code, notes, and snippets.

@cristianciofu
Last active December 6, 2016 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cristianciofu/f6dfbe44f1f1361fe41d2e88205114d9 to your computer and use it in GitHub Desktop.
Save cristianciofu/f6dfbe44f1f1361fe41d2e88205114d9 to your computer and use it in GitHub Desktop.
JS + Bookmarklet - cheat Grand Jeu "Memory de Noël" - E.Leclerc
// More details + demo :
// *****************************************************************
// ===> http://cristianciofu.github.io/cheat-game-leclerc/
// *****************************************************************
// #1 : JS version :
var colors=["#0F5858","#F0A458","#50F1FF","#FF0000","#0062F6","#AF0F40","#FF00FF","#0FF4C6","#00CC00"],matches=[];$.each($("#game>div.card"),function(a,b){$.inArray($("#"+b.id).data("id"),matches)<0&&matches.push($("#"+b.id).data("id")),$("#"+b.id).css("border","8px solid "+colors[$.inArray($("#"+b.id).data("id"),matches)])}),$("#game>div.card").click(function(){$(this).css("border","0")});
// #2 : bookmarklet version :
// javascript:(function()%7Bvar colors %3D %5B'%230F5858'%2C '%23F0A458'%2C '%2350F1FF'%2C '%23FF0000'%2C'%230062F6'%2C '%23AF0F40'%2C '%23FF00FF'%2C '%230FF4C6'%2C '%2300CC00'%5D%3Bvar matches %3D %5B%5D%3B%24.each( %24('%23game>div.card')%2C function(i%2C card) %7Bif (%24.inArray(%24('%23' %2B card.id).data("id")%2C matches) < 0) %7Bmatches.push(%24('%23' %2B card.id).data("id") )%3B%7D%24('%23' %2B card.id).css("border"%2C "8px solid " %2B colors%5B%24.inArray(%24('%23' %2B card.id).data("id")%2C matches)%5D)%3B%7D)%3B%24('%23game>div.card').click(function()%7B%24(this).css("border"%2C "0")%3B%7D)%7D)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment