Copyright Switcher.gg All Rights Reserved 2020
Switch™ content and materials are trademarks and copyrights of Nintendo® and their licensors. All rights reserved.
This site is a part of Switcher.gg and is not affiliated with Nintendo®.
Privacy Policy | Contact
'; /*
' + (e.image ? '
' : "") + '
' + (e.name ? '' + i(e.name) + "" : "") + (e.message ? '' + i(e.message) + "" : "") + "
" + (e.icon ? '' : "") + "
" */ } }, load: function(query, callback) { if (!query.length) return callback(); $.ajax({ url: 'https://switcher.gg/handler/search_user.php?q=' + encodeURIComponent(query), type: 'GET', error: function() { callback(); }, success: function(res) { console.log(res.results); callback(res.repositories.slice(0, 10)); } }); } }); var typingTimer; //timer identifier const doneTypingInterval = 500; //time in ms, 5 second for example var $searchinput = $('.js-user-search2'); var ajax=null; //on keyup, start the countdown $searchinput.on('keyup', function () { // console.log('hhh'); clearTimeout(typingTimer); typingTimer = setTimeout(doneTyping, doneTypingInterval); }); //on keydown, clear the countdown $searchinput.on('keydown', function () { clearTimeout(typingTimer); }); //user is "finished typing," do something function doneTyping () { // console.log('kkkk'); if($searchinput.val()==""){ return false; } if(ajax){ ajax.abort(); } ajax=$.ajax({ url: 'https://switcher.gg/handler/search_user.php?q=' + encodeURIComponent($searchinput.val())+'&add_br=1', type: 'GET', success: function(res) { let resp=JSON.parse(res).results; // console.log(resp); ajax=null; if(resp.length>0){ // process the response console.log(1); dpdown=''; $.each(resp,function(key,value){ dpdown=dpdown+'
'+value.name+''; }); console.log(2); $('.custombygs').html(dpdown); $('.cusbygs').show(); } } }); } $searchinput.on('dblclick',function(){ $('.cusbygs').show(); }); $(document).on('click', function(event) { if (!$(event.target).closest('.jsuserssearch').length) { $('.cusbygs').hide(); } }); // for mobile var $searchinput2 = $('.jsuserssearch2'); //on keyup, start the countdown $searchinput2.on('keyup', function () { clearTimeout(typingTimer); typingTimer = setTimeout(doneTyping2, doneTypingInterval); }); //on keydown, clear the countdown $searchinput2.on('keydown', function () { clearTimeout(typingTimer); }); //user is "finished typing," do something function doneTyping2 () { if($searchinput2.val()==""){ return false; } if(ajax){ ajax.abort(); } ajax=$.ajax({ url: 'https://switcher.gg/handler/search_user.php?q=' + encodeURIComponent($searchinput2.val())+'&add_br=1', type: 'GET', success: function(res) { let resp=JSON.parse(res).results; console.log(resp); ajax=null; if(resp.length>0){ // process the response dpdown=''; $.each(resp,function(key,value){ dpdown=dpdown+'
'+value.name+''; }); $('.custombygs2').html(dpdown); $('.cusbygs2').show(); } } }); }$searchinput2.on('dblclick',function(){ $('.cusbygs2').show();});$(document).on('click', function(event) { if (!$(event.target).closest('.jsuserssearch2').length) { $('.cusbygs2').hide(); }});function imageReceived() { let canvas = document.createElement("canvas"); let context = canvas.getContext("2d"); canvas.id = 'canvasid'; canvas.width = downloadedImg.width; canvas.height = downloadedImg.height; context.drawImage(downloadedImg, 0, 0); document.body.appendChild(canvas); try { localStorage.setItem("saved-image-example", canvas.toDataURL("image/png")); } catch(err) { console.log("Error: " + err); } }$(window).on("load",function fiximages() { $('.game-image-community').each(function() { if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { // image was broken, replace with your new image this.src = '/images/games/blank-image.png'; } });setTimeout(fiximages, 2000)});// $(document).ready(function () {// $(".icon-choices").click(function () {// $('.icon-choices').removeClass('img-border');// //Add the img-border class to the clicked element// $(this).addClass('img-border');// });// });$(document).ready(function () { $(".choose-photo-item").click(function () { $(this).find('img').removeClass('img-border'); //Add the img-border class to the clicked element $(this).find('img').addClass('img-border'); var clickBtnValue = $(".img-border").attr('src'); var tokenid = $(".tokenid").val(); var ajaxurl = 'changeicon.php', data = {'action': clickBtnValue, 'tokenid': tokenid}; $.post(ajaxurl, data, function (response) { $('.icon-select-modal').modal('toggle'); $('#update-header-photo').modal('toggle'); $('.avatar').attr("src",clickBtnValue); setTimeout(function(){swal({ position: 'top-end', type: 'success', title: 'User icon updated successfully.', showConfirmButton: false, timer: 1500})}, 200); });});});//prevent links with # in url from taking to top of page$('a').click(function (e){ //or if you want to perform some conditions if($(this).attr("href")=="#"){ e.preventDefault(); }});$('button').click(function (e){ //or if you want to perform some conditions if($(this).hasClass("prev-def")){ e.preventDefault(); }});// add or remove linkfunction add_remove_game(data){ $.ajax({ url:'https://switcher.gg/handler/add-remove-game.php', method:'POST', data:data, success:function(res){ //console.log(res); output=JSON.parse(res); if (output.success){ if (output.type == 1){ $('.w-create-fav-page .do-you-own-game').text('You own this game'); $('.w-create-fav-page .do-you-own-title').text('Water Balloon Mania is in your game list!'); $('.w-create-fav-page .add-game-btn').text('Remove Game'); $('.w-create-fav-page .btn').addClass('remove-game-btn'); $('.w-create-fav-page .btn').removeClass('add-game-btn'); } if (output.type == 2){ $('.w-create-fav-page .do-you-own-game').text('Do you own this game?'); $('.w-create-fav-page .do-you-own-title').text('AddWater Balloon Mania to your game list!'); $('.w-create-fav-page .remove-game-btn').text('Add This Game'); $('.w-create-fav-page .btn').addClass('add-game-btn'); $('.w-create-fav-page .btn').removeClass('remove-game-btn'); // $('.add-game-btn').removeClass('remove-game-btn'); } swal({ position: 'top-end', type: 'success', title: 'Game list updated.', showConfirmButton: false, timer: 1500}) }else{ swal({ position: 'top-end', type: 'error', title: 'An error occured. Please try again.', showConfirmButton: false, timer: 1500}) } } });};$('.content').on('click','.add-game-btn',function(e){ e.preventDefault(); let game_id=$(this).data('id'); let tokenid=$('.tokenid').val(); let data={ game_id:game_id, tokenid:tokenid, add:1 } add_remove_game(data);});$('.content').on('click','.remove-game-btn',function(e){ e.preventDefault(); let game_id=$(this).data('id'); let tokenid=$('.tokenid').val(); let data={ game_id:game_id, tokenid:tokenid, remove:1 } add_remove_game(data);});$( document ).ready(function() { setTimeout(function() {Swal.fire({ position: 'bottom-start', title: " Graz is playing
Human Resource Machine", //html: data.userWhoInvite + " is looking for players for " + data.gameTitle + "", confirmButtonColor: '#3085d6', confirmButtonText: "Play now", // footer: "Turn off these notifications", showCloseButton: true, allowOutsideClick: true, backdrop:false, // imageUrl: data.gameImg, // imageHeight: 50, // imageWidth: 50, // timer: 600000, customClass: 'gameNotify-cont' }).then((result) => { if (result.value) { window.location.href = "https://switcher.gg/login"; } }) }, 2000); });$(window).on("load",function fiximages() { $('img').each(function() { if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { // image was broken, replace with your new image this.src = '/images/profilephotos/star.png'; } }); setTimeout(fiximages, 2020) });