searchCatalog=[ { "gameName":"Aztec Tribe New Land", "gameNameNorm":"aztec_tribe_new_land", "gameDesc":"Restore a band of struggling natives to their former glory by gathering resources, building and upgrading buildings and hiring workers in this village-building themed game.", "gameLink":"/games/719250/aztec_tribe_new_land", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/719250/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/719250/screenshot2_sm.jpg", "gameId":719250, "gameRank":200.0, "gameSize":67, "gameProductionTime":"", "gameLink":"/games/719250/aztec_tribe_new_land", "gameType" : "0 " } , { "gameName":"Defense of Roman Britain", "gameNameNorm":"defense_of_roman_britain", "gameDesc":"Prosperity of Roman Empire and Emperor\'s life depends of you.", "gameLink":"/games/854850/defense_of_roman_britain", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/854850/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/854850/screenshot2_sm.jpg", "gameId":854850, "gameRank":0.0, "gameSize":129, "gameProductionTime":"", "gameLink":"/games/854850/defense_of_roman_britain", "gameType" : "2 " } , { "gameName":"Heroes of Kaleva", "gameNameNorm":"heroes_of_kaleva", "gameDesc":"Choose your favorite hero and lead your tribe towards a bright new future in the lands of Kalevala, en epic Match-3 puzzler!\t\r\n", "gameLink":"/games/758350/heroes_of_kaleva", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/758350/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/758350/screenshot2_sm.jpg", "gameId":758350, "gameRank":200.0, "gameSize":53, "gameProductionTime":"", "gameLink":"/games/758350/heroes_of_kaleva", "gameType" : "0 " } , { "gameName":"Island Tribe", "gameNameNorm":"island_tribe", "gameDesc":"Explore, gather, produce, trade, build, repair and work for the well-being of all of your subjects. But watch out! The greedy count Ohli and his spies never sleep!", "gameLink":"/games/726750/island_tribe", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/726750/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/726750/screenshot2_sm.jpg", "gameId":726750, "gameRank":0.0, "gameSize":67, "gameProductionTime":"", "gameLink":"/games/726750/island_tribe", "gameType" : "2 " } , { "gameName":"Island Tribe 2", "gameNameNorm":"island_tribe_2", "gameDesc":"Get ready for new adventures in the second part of the Island Tribe series. Be one of the first to know what has happened to the settlers after their escape from the great volcano!", "gameLink":"/games/736050/island_tribe_2", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/736050/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/736050/screenshot2_sm.jpg", "gameId":736050, "gameRank":202.32535, "gameSize":112, "gameProductionTime":"", "gameLink":"/games/736050/island_tribe_2", "gameType" : "0 " } , { "gameName":"Island Tribe 3", "gameNameNorm":"island_tribe_3", "gameDesc":"Help the chieftain find his bride and restore the once-beautiful home of the islanders with the wonderful new chapter in the hit resource-collection series.", "gameLink":"/games/762150/island_tribe_3", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/762150/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/762150/screenshot2_sm.jpg", "gameId":762150, "gameRank":204.71326, "gameSize":133, "gameProductionTime":"", "gameLink":"/games/762150/island_tribe_3", "gameType" : "0 " } , { "gameName":"Jack Of All Tribes", "gameNameNorm":"jack_of_all_tribes", "gameDesc":"Join Jack after he goes back in time and stumbles upon an ancient tribe in need of help! Rule a primeval world in this seamless blend of time management and building simulation games. NOTE: Not supported on Windows XP.", "gameLink":"/games/720450/jack_of_all_tribes", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/720450/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/720450/screenshot2_sm.jpg", "gameId":720450, "gameRank":100.0, "gameSize":134, "gameProductionTime":"", "gameLink":"/games/720450/jack_of_all_tribes", "gameType" : "0 " } , { "gameName":"Jewels of East India Company", "gameNameNorm":"jewels_of_east_india_company", "gameDesc":"Join the expedition to a mysterious mountain range in this fantastic Match 3 ", "gameLink":"/games/768750/jewels_of_east_india_company", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/768750/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/768750/screenshot2_sm.jpg", "gameId":768750, "gameRank":0.0, "gameSize":142, "gameProductionTime":"", "gameLink":"/games/768750/jewels_of_east_india_company", "gameType" : "0 " } , { "gameName":"Shaman Odyssey: Tropic Adventure", "gameNameNorm":"shaman_odyssey_tropic_adventure", "gameDesc":"Would you believe that life on a tropical island is not without its challenges? As a Shaman, it\'s up to you to overcome the island\'s harsher elements and reunite your tribe so that they may live in a true paradise.", "gameLink":"/games/667850/shaman_odyssey_tropic_adventure", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/667850/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/667850/screenshot2_sm.jpg", "gameId":667850, "gameRank":200.0, "gameSize":61, "gameProductionTime":"", "gameLink":"/games/667850/shaman_odyssey_tropic_adventure", "gameType" : "2 " } , { "gameName":"The Timebuilders Cavemans Prophecy", "gameNameNorm":"the_timebuilders_cavemans_prophecy", "gameDesc":"Guide your tribe out of their cave and into the world in the era when dinosaurs ruled the earth", "gameLink":"/games/798650/the_timebuilders_cavemans_prophecy", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/798650/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/798650/screenshot2_sm.jpg", "gameId":798650, "gameRank":100.0, "gameSize":136, "gameProductionTime":"", "gameLink":"/games/798650/the_timebuilders_cavemans_prophecy", "gameType" : "0 " } , { "gameName":"Tulula - Legend of a Volcano", "gameNameNorm":"tulula_legend_of_a_volcano", "gameDesc":"Save a small tribe from an evil spell by rescuing the tribe\'s shaman who has been imprisoned by an evil spirit.", "gameLink":"/games/708750/tulula_legend_of_a_volcano", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/708750/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/708750/screenshot2_sm.jpg", "gameId":708750, "gameRank":0.0, "gameSize":176, "gameProductionTime":"", "gameLink":"/games/708750/tulula_legend_of_a_volcano", "gameType" : "2 " } , { "gameName":"Virtual Villagers 4: The Tree of Life", "gameNameNorm":"virtual_villagers_4_the_tree_of_life", "gameDesc":"Uncover fantastic mysteries, unravel the story of Isola, and save the Tree of Life!", "gameLink":"/games/676750/virtual_villagers_4_the_tree_of_life", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/676750/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/676750/screenshot2_sm.jpg", "gameId":676750, "gameRank":100.0, "gameSize":72, "gameProductionTime":"", "gameLink":"/games/676750/virtual_villagers_4_the_tree_of_life", "gameType" : "0 " } , { "gameName":"Virtual Villagers 5", "gameNameNorm":"virtual_villagers_5", "gameDesc":"Guide your little villagers as they attempt to convert a group of masked heathens, by dismantling their precious totems and removing their scary masks!", "gameLink":"/games/717850/virtual_villagers_5", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/717850/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/717850/screenshot2_sm.jpg", "gameId":717850, "gameRank":205.51228, "gameSize":65, "gameProductionTime":"", "gameLink":"/games/717850/virtual_villagers_5", "gameType" : "0 " } , { "gameName":"Virtual Villagers: A New Home", "gameNameNorm":"virtual_villagers_a_new_home", "gameDesc":"Care for and nurture a tribe of little people by teaching them the basics of survival", "gameLink":"/games/629250/virtual_villagers_a_new_home", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/629250/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/629250/screenshot2_sm.jpg", "gameId":629250, "gameRank":205.29529, "gameSize":19, "gameProductionTime":"", "gameLink":"/games/629250/virtual_villagers_a_new_home", "gameType" : "0 " } ]; $(document).ready(function(){ boxData = genreCatalog_getBoxData(); $("#genreCatalog_sortOptions li").click(function() { // move selected option to be first $(this).parent().prepend( $(this)); genreCatalog_sort( $(this).attr("sort") ); genreCatalog_changeHash(); genreCatalog_render(); genreCatalog_loadVisibleImages(); genreCatalog_setupPopup(); }); $("#genreCatalog_sortOptions li").each(function() { if( $(this).attr("sort") == genreCatalog_getHashParam("sort") ) { $(this).parent().prepend( $(this)); } }); genreCatalog_sort(genreCatalog_getHashParam("sort")); genreCatalog_render(); genreCatalog_loadVisibleImages(); genreCatalog_setupPopup(); }); function genreCatalog_getBoxData() { imageBase = "https://img.exent.com/free/frg/products/%GAME_ID%/boxshot.jpg"; box = $('#genreCatalog'); cols = box.attr("cols"); rows = box.attr("rows"); slideContainer = box.find(".slides_container")[0]; pagination = box.find("div.pagenation") paginationBulletContainer = $(pagination).find("ul"); games = searchCatalog; numberOfGames = games.length; return {imageBase:imageBase, box:box, games:games, slideContainer:slideContainer, cols:cols, rows:rows, numberOfGames:numberOfGames, pagination:pagination, paginationBulletContainer:paginationBulletContainer}; } /** * Destroys the genreCatalog's content, and rebuild it acording to the gamelist */ function genreCatalog_render () { boxData = genreCatalog_getBoxData(); //gameBox_sort() genreCatalog_reset(); if(boxData.games[0].errorMsg!=null){ $("#genreCatalog").append('
'+boxData.games[0].errorMsg+'
'); $('.pagenation_rib').remove(); return; } for(i=0; i') currentSlide = $(slideContainer).find(".slide:last-child"); } var defaultSlide = ' \
\
\ \
'+game.gameName+'
\
\
'; var premiumGameSlide = ' \
\ \ \
'+game.gameName+'
\ \
\
'; if(game.gameType == 2){ //if premium game $(currentSlide).append(premiumGameSlide); } else{ $(currentSlide).append(defaultSlide); } } genreCatalog_setPagination(); setTimeout( function(){ $(boxData.pagination).find("a,div").click(function() { genreCatalog_loadVisibleImages(); genreCatalog_changeHash(); }); },100); Utils.fixUnloadImages(); } function genreCatalog_setPagination (currentPage) { boxData = genreCatalog_getBoxData(); if (boxData.numberOfGames > boxData.cols*boxData.rows) { $(boxData.box).slides({pagination: true, paginationClass:'paginationGenreCatalog', next:'nextGenreCatalog',prev:'prevGenreCatalog',start:genreCatalog_getHashParam("page")}); $(boxData.pagination).show(); } else { $(boxData.pagination).hide(); } $(boxData.box).find('.slide').width( $(boxData.box).width()+"px" ); } function genreCatalog_reset() { boxData = genreCatalog_getBoxData(); $(boxData.slideContainer).empty(); $(boxData.paginationBulletContainer).empty(); } function genreCatalog_sort(type) { boxData = genreCatalog_getBoxData(); function sortGamesByRank(a,b) { if ( a.gameRank == b.gameRank ) { return a.gameName.localeCompare(b.gameName); } else { return a.gameRank - b.gameRank; } } function sortGamesByName(a,b) { return a.gameName.localeCompare(b.gameName); } if (type == "a-z") { boxData.games.sort(sortGamesByName); } else if (type == "rank") { boxData.games.sort(sortGamesByRank).reverse(); } else { boxData.games.sort(sortGamesByName); } } function genreCatalog_loadVisibleImages () { boxData = genreCatalog_getBoxData(); $(boxData.box).find("img:visible").each(function () { $(this).attr("src",$(this).attr("image-src")); }); } function genreCatalog_changeHash() { hash = ""; boxData = genreCatalog_getBoxData(); currentPage = $(boxData.paginationBulletContainer).find("li").index( $(boxData.paginationBulletContainer).find(".current")[0] )+1; currentSort = $("#genreCatalog_sortOptions li:first").attr("sort"); hash+= ("page="+currentPage); hash+= ("&sort="+currentSort); window.location.hash = hash; } function genreCatalog_getHashParam(paramName) { attributes = window.location.hash.substr(1).split("&"); for (i=0; i 0){ //if the image have the premium styles (class=premiumGameBorder_small) var premiumTitle = $("
FreeRide Club members only
"); $("#genreCatalog_popup .inner_container").prepend(premiumTitle); var playWithoutAdsBtn = $(""); $(playWithoutAdsBtn).insertBefore('#genreCatalog_popup .inner_container .clear'); $("#genreCatalog_popup #genreCatalog_downloadButton .blue_btn_28_left").removeClass("blue_btn_28_left").addClass("yellow_btn_28_left"); $("#genreCatalog_popup #genreCatalog_downloadButton .blue_btn_28_mid").css('color','#0a325f'); $("#genreCatalog_popup #genreCatalog_downloadButton .blue_btn_28_mid").removeClass("blue_btn_28_mid").addClass("yellow_btn_28_middle"); $("#genreCatalog_popup #genreCatalog_downloadButton .blue_download_btn_28_right").removeClass("blue_download_btn_28_right").addClass("yellow_btn_28_right"); } } }