Permalink
Browse files

Up/Down independent scroll speeds.

  • Loading branch information...
1 parent 9aef626 commit ce455a9022522ba759be47eb32d23c9c9ea36c23 @codysherman committed Jan 3, 2011
View
3 README
@@ -10,7 +10,6 @@ Great for when viewing long/infinite pages such as Facebook, Twitter, etc.
Inspired by the Tumblr Dashboard!
-To install: https://chrome.google.com/extensions/detail/chiikmhgllekggjhdfjhajkfdkcngplp
+To install: https://chrome.google.com/webstore/detail/chiikmhgllekggjhdfjhajkfdkcngplp
Source code at: http://github.com/codysherman/Scroll-to-Top-Button-Extension
-test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -4,6 +4,9 @@
if (!localStorage["scroll_speed"]) {
localStorage["scroll_speed"] = 1000;
}
+ if (!localStorage["scroll_speed2"]) {
+ localStorage["scroll_speed2"] = localStorage["scroll_speed"];
+ }
if (!localStorage["distance_length"]) {
localStorage["distance_length"] = 400;
}
@@ -25,18 +28,33 @@
if (!localStorage["transparency"]) {
localStorage["transparency"] = "0.5";
}
+ if (!localStorage["loadcount"]) {
+ localStorage["loadcount"] = "0";
+ }
+ if (!localStorage["donated"]) {
+ if ((localStorage["loadcount"]>=40) && (localStorage["bothered"]!="1")) {
+ chrome.tabs.create({url:'http://scrolltotopbutton.tumblr.com/STTBdonate',selected:false});
+ localStorage["bothered"]="1";
+ }
+ }
if (localStorage["stbb"]=="on") {
localStorage["stbb"] = "flip";
}
if (localStorage["latest"]!="2"){
chrome.tabs.create({url:'/options.html',selected:false});
}
+loadcount=localStorage["loadcount"];
+loadcount++;
+localStorage["loadcount"]=loadcount;
+
// Message passer to give [LocalStorage] settings to content_script.js which is not allowed access to [LocalStorage].
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
if (request.greeting == "settings")
- sendResponse({speed: localStorage["scroll_speed"], distance: localStorage["distance_length"], size: localStorage["size"], arrow: localStorage["arrow"], scroll:"jswing", location: localStorage["location"], stbb: localStorage["stbb"], transparency: localStorage["transparency"]});
+ sendResponse({speed: localStorage["scroll_speed"], speed2: localStorage["scroll_speed2"], distance: localStorage["distance_length"], size: localStorage["size"], arrow: localStorage["arrow"], scroll:"jswing", location: localStorage["location"], stbb: localStorage["stbb"], transparency: localStorage["transparency"]});
+ else if (request.greeting == "donated")
+ localStorage["donated"] = "1";
else
sendResponse({}); // snub them.
});
View
@@ -7,11 +7,11 @@
*
* Description: Scroll to Top Button allows you to quickly jump back to the top of any page! Once you scroll far enough down on a page, the button will appear in the top right corner. Click it, and you will be taken to the very top in no time!
*
-* To install: https://chrome.google.com/extensions/detail/chiikmhgllekggjhdfjhajkfdkcngplp
+* To install: https://chrome.google.com/webstore/detail/chiikmhgllekggjhdfjhajkfdkcngplp
*
*Source code at: http://github.com/codysherman/Scroll-to-Top-Button-Extension
*
-*Version: 4.4.2
+*Version: 4.6.0
-----------------------*/
STTB();
@@ -24,6 +24,9 @@ if (window.location.href.indexOf('http://www.tumblr.com/') != -1) {
else if (window.location.href.indexOf('http://www.tumblr.com/tumblelog/') != -1) {
$('#return_to_top').remove();
}
+ else if (window.location.href.indexOf('http://www.tumblr.com/messages') != -1) {
+ $('#return_to_top').remove();
+ }
else if (window.location.href.indexOf('http://www.tumblr.com/tagged/') != -1) {
$('#return_to_top').remove();
}
@@ -33,15 +36,17 @@ if (window.location.href.indexOf('http://www.tumblr.com/') != -1) {
else if (window.location.href.indexOf('http://www.tumblr.com/likes') != -1) {
$('#return_to_top').remove();
}
- else if (window.location.href.indexOf('http://www.tumblr.com/messages') != -1) {
- $('#return_to_top').remove();
- }
+}
+
+if (window.location.href.indexOf('http://scrolltotopbutton.tumblr.com/donationcompleted') != -1) {
+ chrome.extension.sendRequest({greeting: "donated"});
}
function STTB() {
// Asks background.html for [LocalStorage] settings.
chrome.extension.sendRequest({greeting: "settings"}, function(response) {
var speed = parseInt(response.speed);
+var speed2 = parseInt(response.speed2);
var distance = parseInt(response.distance);
var flipDistance = parseInt(response.distance);
var size = response.size;
@@ -53,6 +58,7 @@ var transparency = response.transparency;
if (stbb == "dual"){
var imgURL=chrome.extension.getURL("arrows/dual/"+arrow+".png");
+var imgURL2=chrome.extension.getURL("arrows/dualdown/"+arrow+".png");
}
else{
var imgURL=chrome.extension.getURL("arrows/"+arrow+".png");
@@ -142,9 +148,9 @@ else if ((location == "BC") && (stbb == "dual")) {
if(stbb=="dual"){
$("body").prepend('<img id=STTBimg2 />');
- $("#STTBimg2").rotate(-180);
+ //$("#STTBimg2").rotate(-180);
STTBimg2.style.opacity = transparency;
-STTBimg2.src=imgURL;
+STTBimg2.src=imgURL2;
STTBimg2.style.position = 'fixed';
STTBimg2.style.width = size;
STTBimg2.style.height = 'auto';
@@ -257,19 +263,19 @@ $("#STTBimg2").hover(function(){
// Calls, and passes variables to jquery.scroll.pack.js which finds the created button and applies the scrolling rules.
$("#STTBimg").scrollToTop({speed:speed, ease:scroll, start:distance, stbb:stbb, flipDistance:flipDistance, transparency:transparency, direction:"up"});
- $("#STTBimg2").scrollToTop({speed:speed, ease:scroll, start:distance, stbb:stbb, flipDistance:flipDistance, transparency:transparency, direction:"down"});
+ $("#STTBimg2").scrollToTop({speed:speed2, ease:scroll, start:distance, stbb:stbb, flipDistance:flipDistance, transparency:transparency, direction:"down"});
} //Keyboard Only
- shortcut.add("Alt+Down", function() {
- DOWN(speed, scroll);
+ shortcut.add("Alt+B", function() {
+ DOWN(speed2, scroll);
});
shortcut.add("End", function() {
- DOWN(speed, scroll);
+ DOWN(speed2, scroll);
},{
'disable_in_input':true
});
- shortcut.add("Alt+Up", function() {
+ shortcut.add("Alt+T", function() {
UP(speed, scroll);
});
shortcut.add("Home", function() {
@@ -291,6 +297,12 @@ $(document).ready(function($) {
else if (window.location.href.indexOf('docs.google.com/') != -1) {
REMOVE();
}
+ else if (window.location.href.indexOf('calendar.google.com/') != -1) {
+ REMOVE();
+ }
+ else if (window.location.href.indexOf('spreadsheets.google.com/') != -1) {
+ REMOVE();
+ }
function REMOVE() {
$('#STTBimg').fadeTo('fast', 0.0, function() {
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -1,6 +1,6 @@
{
"name": "Scroll to Top Button",
- "version": "4.4.2",
+ "version": "4.6.0",
"description": "Adds a scroll to top/bottom button.",
"icons": {"16": "icons/icon16.png",
"32": "icons/icon32.png",
View
@@ -9,8 +9,14 @@
<script type="text/javascript">
// Restores default settings.
-function defaults() {
+function defaults() {
+ loadcount=localStorage["loadcount"];
+ donated=localStorage["donated"];
+ bothered=localStorage["bothered"];
localStorage.clear();
+ localStorage["loadcount"]=loadcount;
+ localStorage["bothered"]=bothered;
+ localStorage["donated"]=donated;
localStorage["latest"]="2";
restore_options();
save_options();
@@ -19,6 +25,7 @@
function authorsettings() {
localStorage["scroll_speed"]="1000";
+ localStorage["scroll_speed2"]="1000";
localStorage["size"]="50px";
localStorage["arrow"]="arrow_only_blue";
localStorage["location"]="CR";
@@ -33,7 +40,11 @@
function save_options() {
var select = document.getElementById("speed");
var speed = select.children[select.selectedIndex].value;
- localStorage["scroll_speed"] = speed;
+ localStorage["scroll_speed"] = speed;
+
+ var select = document.getElementById("speed2");
+ var speed2 = select.children[select.selectedIndex].value;
+ localStorage["scroll_speed2"] = speed2;
var select = document.getElementById("distance");
var distance = select.children[select.selectedIndex].value;
@@ -84,6 +95,18 @@
child.selected = "true";
break;
}
+ }
+ var favorite = localStorage["scroll_speed2"];
+ if (!favorite) {
+ favorite = 1000;
+ }
+ var select = document.getElementById("speed2");
+ for (var i = 0; i < select.children.length; i++) {
+ var child = select.children[i];
+ if (child.value == favorite) {
+ child.selected = "true";
+ break;
+ }
}
var favorite2 = localStorage["distance_length"];
if (!favorite2) {
@@ -198,30 +221,37 @@
else if (option == 8) {
_gaq.push(['_trackEvent', 'Transparency', localStorage["transparency"]]);
}
+ else if (option == 9) {
+ _gaq.push(['_trackEvent', 'Scroll Speed Down', localStorage["scroll_speed2"]]);
+ }
}
function textChange(){
if(localStorage["stbb"]=="flip"){
$("#textChange").html("Flip Distance:");
$("#textChange").show();
$("#distance").show();
- $(".appearance").show();
+ $(".appearance").show();
+ $(".down").show();
}
else if(localStorage["stbb"]=="dual"){
$("#textChange").hide();
$("#distance").hide();
- $(".appearance").show();
+ $(".appearance").show();
+ $(".down").show();
}
else if(localStorage["stbb"]=="keys"){
$("#textChange").hide();
$("#distance").hide();
- $(".appearance").hide();
+ $(".appearance").hide();
+ $(".down").show();
}
else{
$("#textChange").html("Appear Distance:");
$("#textChange").show();
$("#distance").show();
- $(".appearance").show();
+ $(".appearance").show();
+ $(".down").hide();
}
}
@@ -251,22 +281,22 @@
<ul class="features">
<li>Dual button mode! Scroll to the top or the bottom!</li>
<li>You can now choose to put it on the middle left or right</li>
- <li>Keyboard shortcuts! Alt+Up or Alt+Down (Thanks to <a href="http://davidblasiak.tumblr.com/" target="_blank">David Blasiak</a>!)</li>
+ <li>Keyboard shortcuts! Alt+T or Alt+B (Thanks to <a href="http://davidblasiak.tumblr.com/" target="_blank">David Blasiak</a>!)</li>
<li>Bug fixes</li></ul></strong>
<p><center><a href="http://scrolltotopbutton.tumblr.com/" target="_blank">Keep up to date on new features here!</a></center></p>-->
</div>
-<p><strong>Please <a href="https://chrome.google.com/extensions/detail/chiikmhgllekggjhdfjhajkfdkcngplp" target="_blank">rate this extension</a> if you enjoy it! Or request a new feature! The feedback really means a lot to me!</strong></p>
+<p><strong>Please <a href="https://chrome.google.com/webstore/detail/chiikmhgllekggjhdfjhajkfdkcngplp" target="_blank">rate this extension</a> if you enjoy it! Or request a new feature! The feedback really means a lot to me!</strong></p>
<p>
Button Mode:
<select id="stbb" onChange="save_options();textChange();report(7)">
- <option value="off">Scroll to Top Button Only</option>
+ <option value="off">Scroll to Top Only</option>
<option value="flip">Flip between Top/Bottom</option>
<option value="dual">Dual Arrows</option>
<option value="keys">Keyboard Only</option>
</select>
</p>
<p>
-Scroll Speed:
+Scroll Up Speed:
<select id="speed" onChange="save_options();report(1)">
<option value="40000">Slowest</option>
<option value="20000">Slower</option>
@@ -275,6 +305,18 @@
<option value="100">Faster</option>
<option value="1">Fastest (Instant)</option>
</select>
+</p>
+<p>
+<div class="down" style="clear:left;padding-right:4px;">Scroll Down Speed:
+<select id="speed2" onChange="save_options();report(9)">
+ <option value="40000">Slowest</option>
+ <option value="20000">Slower</option>
+ <option value="2000">Slow</option>
+ <option value="1000">Fast</option>
+ <option value="100">Faster</option>
+ <option value="1">Fastest (Instant)</option>
+</select>
+</div>
</p>
<p>
<div id="textChange" style="float:left;padding-right:4px;">Appear Distance:</div>
@@ -353,13 +395,20 @@
<button id="restore" onClick="defaults()"></button>
<button id="author" onClick="authorsettings()"></button>
<p id="status" style="float:left; font-size:.9em; line-height:.5; padding:3px 0 0 10px;"></p>
-<p style="padding-top:60px;">Press Alt+Up / Alt+Down or Home / End on a page to scroll with just your keyboard!</p>
+<p style="padding-top:60px;">Press Alt+T/Alt+B or Home/End on a page to scroll with just your keyboard!</p>
<p><strong>Do you speak multiple languages? Please help me translate this extension! <a href="mailto:sttb@codysherman.com">Email me!</a></strong></p>
<div id="bottomNav">
<a href="http://scrolltotopbutton.tumblr.com/" target="_blank"><div id="release"></div></a>
<a href="http://github.com/codysherman/Scroll-to-Top-Button-Extension" target="_blank"><div id="source"></div></a>
-<a href="http://codysherman.com/" target="_blank"><div id="cody"></div></a>
+<a href="http://codysherman.com/" target="_blank"><div id="cody"></div></a>
+</div>
+<div style="border:1px #434b52 solid;height:60px;">
+<div style="float:left;padding-left:3px;width:440px;padding-top:3px;">A fan of Scroll to Top Button? Donate! You can donate whatever amount you would like, and I would appreciate anything I can get to help pay for college and stuffs :) <a href="http://scrolltotopbutton.tumblr.com/donate" target="_blank">Need convincing?</a></div>
+<div style="padding-top:12px;padding-left:10px;float:left;">
+<a href="http://scrolltotopbutton.tumblr.com/donate-amount-check"><img src="/images/donate.png" alt="Donate"/></a>
+</div>
</div>
+
</div>
</div>
<script>
View
@@ -32,7 +32,7 @@ outline: none;
width:827px;
margin-left:auto;
margin-right:auto;
- padding-top:50px;
+ padding-top:20px;
}
#content {
width:600px;

0 comments on commit ce455a9

Please sign in to comment.