Skip to content

Commit 7e765eb

Browse files
authored
Fix bugs and add a feature. (#22)
* Added the ability to follow scrolls to elements. * Fix the unable view bug.
1 parent cdc696d commit 7e765eb

File tree

7 files changed

+24
-7
lines changed

7 files changed

+24
-7
lines changed

dist/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Quick Custom GSearch",
4-
"version": "0.7.3",
4+
"version": "0.7.5",
55
"description": "Quick access for custom search functions",
66
"page_action": {
77
"default_icon": "19.png"

dist/script.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ div.quick-custom-gsearch .language {
4040
margin-top: 5px;
4141
}
4242

43-
div.quick-custom-gsearch .term span.head,
44-
div.quick-custom-gsearch .language span.head {
43+
div.quick-custom-gsearch .term span.head,
44+
div.quick-custom-gsearch .language span.head {
4545
height: 1.7em;
4646
display: block;
4747
padding: 8px 0 0 6px;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"webpack-cli": "^3.3.12"
1212
},
1313
"scripts": {
14-
"start": "yarn build:dev -- -w",
14+
"start": "webpack -d -w",
1515
"lint": "eslint --fix src/**/*.js",
1616
"test": "mocha -c --require test/setup.js test/**/*.spec.js",
1717
"build:dev": "webpack -d",

src/main.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ const Add = () => {
3232
return false;
3333
};
3434

35+
const CallOnscroll = () => {
36+
function fixing() {
37+
const e = document.querySelector('.quick-custom-gsearch');
38+
const y = window.scrollY;
39+
if (y > 90) {
40+
e.style.position = 'fixed';
41+
e.style.top = '70px';
42+
} else {
43+
e.style.position = 'absolute';
44+
e.style.top = '159px';
45+
}
46+
}
47+
window.onscroll = fixing;
48+
};
49+
3550
const Main = () => {
3651
const Observer = new MutationObserver(() => {
3752
Add();
@@ -42,6 +57,8 @@ const Main = () => {
4257
Add();
4358
Observer.observe(elm, { childList: true });
4459
}
60+
61+
CallOnscroll();
4562
};
4663

4764
Main();

src/mainView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const MainView = {
1010
return mainDiv;
1111
},
1212
BindElement(div) {
13-
const ucs = document.querySelector('div#ucs');
13+
const ucs = document.querySelector('div#main');
1414
ucs.insertBefore(div, ucs.firstChild);
1515
},
1616
};

src/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const Model = require('./model.js');
22

33
const Parser = {
44
IsUCS() {
5-
const ucs = document.querySelector('div#ucs');
5+
const ucs = document.querySelector('div#main');
66
return ucs !== null;
77
},
88
IsTextSearch() {

0 commit comments

Comments
 (0)