Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added I'm feeling lucky button and made the display of google search result more meaningful #69

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions googleCS.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
var st, x, pos;
var s = document.createElement("script");
s.src = chrome.extension.getURL("googleFearch.js");
(document.head || document.documentElement).appendChild(s);

// removing Index of portions

x = document.getElementsByClassName("r");

for (var i = 0; i < x.length; i++) {
st = x[i].innerHTML;
pos = st.search("Index of /" || "Index of");
if (pos !== -1) {
x[i].innerHTML = st.replace(st.substring(pos,pos+10),"");
}
}

// After loading and execution, the node disappears so no one can trace code.

s.onload = function () {
s.parentNode.removeChild(s);
};
2 changes: 1 addition & 1 deletion googleFearch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ input:focus {
display: inline-block;
border-radius: 2px;
transition: all 0.5s;
margin-top: 12px;
}

#suggest-label:hover {
Expand Down Expand Up @@ -125,7 +126,21 @@ input:focus {
text-align: center;
position: absolute;
margin: 0px auto;
margin-bottom: 35px;
border-radius: 2px;
left: 18%;
bottom: 6%;
}

#imfl {
padding: 3%;
padding-left: 5%;
padding-right: 5%;
background-color: rgba(0,0,0,0.1);
border-radius: 5%;
border:0px solid rgba(0,0,0,0.3);
}
#imfl:hover {
background-color: rgba(0,0,0,0.2);
border:0px solid rgba(0,0,0,0.5);
}
9 changes: 5 additions & 4 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<title>music extension</title>
<title>Music extension</title>
<link href="popup.css" rel="stylesheet" type="text/css">
<script src="popup.js"></script>
</head>
Expand All @@ -26,7 +26,7 @@ <h1><span style="color:#4285f4">F</span><span style="color:#ea4335">e</span><spa
<tr>
<td>
<div id="searchWarning" style="display: none;">
&#9762 Please enter search query.
Please enter search query.
</div>
</td>
</tr>
Expand All @@ -52,15 +52,16 @@ <h1><span style="color:#4285f4">F</span><span style="color:#ea4335">e</span><spa
<tr>
<td>
<div id="checkboxWarning" style="display: none;">
&#9762 Please select one or more of the checkboxes.
Please select one or more of the checkboxes.
</div>
</td>
</tr>
<table>
</form>
</div>
<div id="footer">
<center><button id="imfl">I'm feeling lucky</button></center>

</div>
</body>

</html>
9 changes: 9 additions & 0 deletions popup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
// I'm feling lucky button

function lucky(){
var lButton = document.getElementById("imfl");
lButton.addEventListener("click", function () {
window.open("https://www.google.com/doodles");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everytime the window that gets open is that of doodles page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah , whenever the search query is empty ,this code will work for that only.
@PaliwalSparsh I'm working on it .

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamrishab07 Great, do let me know if you have any problem.

});
}

// Styling content

Expand Down Expand Up @@ -110,4 +118,5 @@ document.addEventListener("DOMContentLoaded", function () {
document.querySelector("button").addEventListener("click", register);
suggestion();
suggestionAsValue();
lucky();
});