Search tool

Search tool for Steamgifts.

目前为 2015-11-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         Search tool
// @description  Search tool for Steamgifts.
// @version      0.2.1
// @author       otro_user_gil
// @include      http://www.steamgifts.com/
// @include      https://steamgifts.com/
// @include      http://*.steamgifts.com/
// @include      https://*.steamgifts.com/
// @include      http://www.steamgifts.com/giveaway/*
// @include      https://steamgifts.com/giveaway/*
// @include      http://*.steamgifts.com/giveaway/*
// @include      https://*.steamgifts.com/giveaway/*
// @include      http://www.steamgifts.com/giveaways/*
// @include      https://steamgifts.com/giveaways/*
// @include      http://*.steamgifts.com/giveaways/*
// @include      https://*.steamgifts.com/giveaways/*
// @require      http://code.jquery.com/jquery-2.1.4.min.js
// @grant        none
// @namespace https://greasyfork.org/users/15121
// ==/UserScript==

$(".sidebar__mpu").append("<script type='text/javascript'>var url;var search_text;var min_entries;var max_entries;var min_level;var max_level;function ga(){search_text=document.getElementsByName('search-query')[0].value;if(search_text=='Search...'){search_text='';}min_entries=parseInt(document.getElementById('min_entries').value);max_entries=parseInt(document.getElementById('max_entries').value);min_level=document.getElementById('level_min').value;max_level=document.getElementById('level_max').value;if(min_entries>max_entries){alert('Min Entries Can not be higher than Max Entries.');}else if(min_level!='None'&&max_level!='None'&&min_level>max_level){alert('Min Level Can not be higher than Max Level');}else{if(search_text==''){if(isNaN(min_entries)==false||isNaN(max_entries)==false){if(isNaN(min_entries)==false&&isNaN(max_entries)==true){url='http://www.steamgifts.com/giveaways/search?entry_min='+min_entries;location.href=url;}if(isNaN(min_entries)==true&&isNaN(max_entries)==false){url='http://www.steamgifts.com/giveaways/search?entry_max='+max_entries;location.href=url;}if(isNaN(min_entries)==false&&isNaN(max_entries)==false){url='http://www.steamgifts.com/giveaways/search?&entry_min='+min_entries+'&entry_max='+max_entries;location.href=url;}}else{if(min_level=='None'&&max_level=='None'){url='http://www.steamgifts.com/giveaways/search?';location.href=url;}if(max_level=='None'&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?level_min='+min_level;location.href=url;}if(max_level!='None'&&min_level=='None'){url='http://www.steamgifts.com/giveaways/search?level_max='+max_level;location.href=url;}if(max_level!='None'&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?level_min='+min_level+'&level_max='+max_level;location.href=url;}}if(isNaN(min_entries)==false&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_min='+min_entries+'&level_min='+min_level;location.href=url;}if(isNaN(min_entries)==false&&max_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_min='+min_entries+'&level_max='+max_level;location.href=url;}if(isNaN(max_entries)==false&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_max='+max_entries+'&level_min='+min_level;location.href=url;}if(isNaN(max_entries)==false&&max_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_min='+max_entries+'&level_max='+max_level;location.href=url;}if(isNaN(max_entries)==false&&isNaN(min_entries)==false&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_min='+min_entries+'&entry_max='+max_entries+'&level_min='+min_level;location.href=url;}if(isNaN(max_entries)==false&&isNaN(min_entries)==false&&max_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_min='+min_entries+'&entry_max='+max_entries+'&level_max='+max_level;location.href=url;}if(isNaN(max_entries)==false&&isNaN(min_entries)==false&&min_level!='None'&&max_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_min='+min_entries+'&entry_max='+max_entries+'&level_min='+min_level+'&level_max='+max_level;location.href=url;}if(isNaN(min_entries)==false&&max_level!='None'&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_min='+min_entries+'&level_min='+min_level+'&level_max='+max_level;location.href=url;}if(isNaN(max_entries)==false&&max_level!='None'&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?entry_max='+max_entries+'&level_min='+min_level+'&level_max='+max_level;location.href=url;}}else if(search_text!=''){if(isNaN(min_entries)==false||isNaN(max_entries)==false){if(isNaN(min_entries)==false&&isNaN(max_entries)==true){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+min_entries;location.href=url;}if(isNaN(min_entries)==true&&isNaN(max_entries)==false){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_max='+max_entries;location.href=url;}if(isNaN(min_entries)==false&&isNaN(max_entries)==false){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+min_entries+'&entry_max='+max_entries;location.href=url;}}else{if(min_level=='None'&&max_level=='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text;location.href=url;}if(max_level=='None'&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&level_min='+min_level;location.href=url;}if(max_level!='None'&&min_level=='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&level_max='+max_level;location.href=url;}if(max_level!='None'&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&level_min='+min_level+'&level_max='+max_level;location.href=url;}}if(isNaN(min_entries)==false&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+min_entries+'&level_min='+min_level;location.href=url;}if(isNaN(min_entries)==false&&max_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+min_entries+'&level_max='+max_level;location.href=url;}if(isNaN(max_entries)==false&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+max_entries+'&level_min='+min_level;location.href=url;}if(isNaN(max_entries)==false&&max_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+max_entries+'&level_max='+max_level;location.href=url;}if(isNaN(max_entries)==false&&isNaN(min_entries)==false&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+min_entries+'&entry_max='+max_entries+'&level_min='+min_level;location.href=url;}if(isNaN(max_entries)==false&&isNaN(min_entries)==false&&max_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+min_entries+'&entry_max='+max_entries+'&level_max='+max_level;location.href=url;}if(isNaN(max_entries)==false&&isNaN(min_entries)==false&&min_level!='None'&&max_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+min_entries+'&entry_max='+max_entries+'&level_min='+min_level+'&level_max='+max_level;location.href=url;}if(isNaN(min_entries)==false&&max_level!='None'&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_min='+min_entries+'&level_min='+min_level+'&level_max='+max_level;location.href=url;}if(isNaN(max_entries)==false&&max_level!='None'&&min_level!='None'){url='http://www.steamgifts.com/giveaways/search?q='+search_text+'&entry_max='+max_entries+'&level_min='+min_level+'&level_max='+max_level;location.href=url;}}}}</script><hr><div style='position: relative;'><span>Level Min: </span> <select id='level_min' style='width: 90px;'><option>None</option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option></select> <span> Level Max: </span><select id='level_max' style='width: 90px;'><option>None</option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option></select><br><br><span> Min Entries: </span><input type='number' style='width: 60px;' id='min_entries' min='0'> <span> Max Entries: </span> <input type='number' style='width: 60px;' min='0' id='max_entries'><br><br><input type='button' style='cursor: pointer; width: 60px;' value='Search ' onClick='ga()'></div>")