Skip to content

Commit e4af379

Browse files
committed
add files
1 parent 2c92cb4 commit e4af379

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

backTopUserJS.user.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ==UserScript==
2+
// @name backTopUserJS
3+
// @author Aleksandr Filatov
4+
// @license MIT
5+
// @version 1.0
6+
// ==/UserScript==
7+
8+
function main() {
9+
var disp = $(window).scrollTop() > 400 ? 'block' : 'none';
10+
var $upButton = $('<div class="up-button" title="Наверх" style="display:' + disp + '">Наверх</div>');
11+
12+
$(document).find('body').append($upButton);
13+
$upButton.click(function () {
14+
$('html, body').animate({ scrollTop: 0 }, 'slow');
15+
});
16+
17+
$(window).scroll(function () {
18+
if ($(window).scrollTop() > 400) $upButton.fadeIn('slow');
19+
else $upButton.fadeOut('slow');
20+
});
21+
};
22+
23+
var script = document.createElement('script');
24+
script.appendChild(document.createTextNode('('+ main +')();'));
25+
(document.body || document.head || document.documentElement).appendChild(script);

css/style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.up-button{
2+
width: 40px;
3+
height: 40px;
4+
opacity: 0.3;
5+
position: fixed;
6+
bottom: 50px;
7+
right: 100px;
8+
display: none;
9+
text-indent: -9999px;
10+
background-color: #6495ed;
11+
}

jquery.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifest.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"manifest_version": 2,
3+
"content_scripts": [ {
4+
"exclude_globs": [ ],
5+
"include_globs": [ "*" ],
6+
"js": [ "jquery.js", "backTopUserJS.user.js" ],
7+
"css": [ "css/style.css" ],
8+
"matches": [ "http://*/*",
9+
"https://*/*"
10+
],
11+
"run_at": "document_end"
12+
} ],
13+
"converted_from_user_script": true,
14+
"description": "Back top userscript extension for google chrome",
15+
"name": "backTopUserJS",
16+
"version": "1"
17+
}

0 commit comments

Comments
 (0)