1 /////////////////////////////////////////////////
\r
3 /////////////////////////////////////////////////
\r
4 var button = $('#dropdown-button')
\r
5 var subMenu = $('#dropdown-menu')
\r
6 var subMenuItem = $("#dropdown-menu li")
\r
7 var searchButton = $('#search-button')
\r
8 var searchBox = $('#search-box')
\r
11 $(window).resize(function(){
\r
12 if ($(window).width() <= 750){
\r
13 searchButton.text("Search")
\r
14 searchButton.append(' <i class="fal fa-search">');
\r
16 searchButton.text("")
\r
17 searchButton.append(' <i class="fal fa-search">');
\r
22 /////////////////////////////////////////////////
\r
23 // Show Menu Toggle //
\r
24 /////////////////////////////////////////////////
\r
26 button.click(function() {
\r
27 subMenu.slideToggle(250, 'easeInOutQuint');
\r
31 /////////////////////////////////////////////////
\r
32 // Menu Selection //
\r
33 /////////////////////////////////////////////////
\r
35 // Check which sub menu item was clicked
\r
36 subMenuItem.click(function() {
\r
37 console.log($(this).text() + " clicked"); // Tell me which item was clicked.
\r
38 button.text($(this).text()); // Copy the text of the selected menu item to the button.
\r
39 button.append(' <i class="fal fa-' + $(this).attr("value") + '">'); // Set the icon to match the text.
\r
40 button.val($(this).text()); // Set the value of the button to that of the text selected.
\r
41 subMenu.slideToggle(250, 'easeInOutQuint'); // Hide menu after selection is made.
\r
45 /////////////////////////////////////////////////
\r
46 // Controls Enter Key for TextBox //
\r
47 /////////////////////////////////////////////////
\r
48 $(document).ready(function() {
\r
49 $('body').keypress(function(e) {
\r
50 if (e.which == 13) {
\r
51 searchButton.trigger('click');
\r
52 console.log("search button clicked");
\r
57 /////////////////////////////////////////////////
\r
58 // Generates the search string //
\r
59 /////////////////////////////////////////////////
\r
60 $(document).ready(function() {
\r
64 searchButton.click(function() {
\r
65 var type = button.val(); // Set the type valriable to the value of the button.
\r
66 var query = searchBox.val(); // Set the Query variable to the value of the text box.
\r
67 var arr = new Array(); // Create a new blank array.
\r
68 var commonToAll = " -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) " + // This string is common to all searches.
\r
69 "-inurl:(index_of|listen77|mp3raid|mp3toss|mp3drug|index_of|wall" +
\r
70 "ywashis) intitle:\"index.of./\" ";
\r
71 if (query[query.length - 1] == ',') { // Check the length of the search term to see if there were
\r
72 query = query.slice(0, -1) // multiple search terms used, then slice the string at
\r
74 arr = query.split(',');
\r
76 switch (type) { // Compare the type that was set earlier with the cases below
\r
79 var extensions = " (avi|mkv|mov|mp4|mpg|wmv)";
\r
84 var extensions = " (ac3|flac|m4a|mp3|ogg|wav|wma) ";
\r
89 var extensions = " (CBZ|CBR|CHM|DOC|DOCX|EPUB|MOBI|ODT|PDF|RTF|txt)";
\r
94 var extensions = " (bmp|gif|jpg|png|psd|tif|tiff) ";
\r
97 case ("Software/Games"):
\r
99 var extensions = " (apk|exe|iso|rar|tar|zip) ";
\r
102 case ("Compressed"):
\r
104 var extensions = " (7z|bz2|gz|iso|rar|zip) ";
\r
109 var extensions = " (avi|mkv|mov|mp4|mpg|wmv)";
\r
113 for (var i = 0; i < arr.length - 1; i++) {
\r
114 if (arr[i] != "") {
\r
117 temp = temp.replace(/[^\w\s]/gi, '');
\r
119 last = temp.replace(/ /g, ".");
\r
121 var goodinput = "intext:\"" + last + "\"";
\r
122 var finalquery = goodinput + extensions + commonToAll;
\r
124 var url = "https://www.google.com/search?q=" + encodeURIComponent(finalquery);
\r
125 //alert(goodinput);
\r
126 window.open(url, '_blank');
\r