Permalink
Browse files

6.1 Updated jQuery/Rotate/Added shortcut choice

  • Loading branch information...
1 parent ea02164 commit cf0ace7e5ceeb020a72dd5af2371fdadeb883ed3 @codysherman committed May 27, 2011
Showing with 83 additions and 413 deletions.
  1. +9 −6 background.html
  2. +18 −7 content_script.js
  3. +4 −4 jquery.scroll.pack.js
  4. +16 −376 libraries/jQueryRotate.js
  5. +5 −13 libraries/jquery.js
  6. +1 −5 manifest.json
  7. +30 −2 options.html
View
@@ -28,6 +28,9 @@
if (!localStorage["contextmenu"]) {
localStorage["contextmenu"] = "on";
}
+ if (!localStorage["shortcuts"]) {
+ localStorage["shortcuts"] = "arrows";
+ }
if (!localStorage["loadcount"]) {
localStorage["loadcount"] = "0";
}
@@ -37,12 +40,12 @@
localStorage["bothered"]="1";
}
}
- if ((localStorage["loadcount"]>=3) && (localStorage["bothered2"]!="1")) {
- chrome.tabs.create({url:'http://scrolltotopbutton.com/post/3324753379/welcome-to-version-5-0'});
- localStorage["bothered2"]="1";
+ if ((localStorage["bothered2"]!="2")) {
+ chrome.tabs.create({url:'http://scrolltotopbutton.com/post/5310918199'});
+ localStorage["bothered2"]="2";
}
- if ((localStorage["loadcount"]<=2) && (localStorage["bothered2"]!="1")) {
- localStorage["bothered2"]="1";
+ if ((localStorage["loadcount"]<=2) && (localStorage["bothered2"]!="2")) {
+ localStorage["bothered2"]="2";
}
if (localStorage["stbb"]=="on") {
localStorage["stbb"] = "flip";
@@ -60,7 +63,7 @@
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
if (request.greeting == "settings")
- 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"]});
+ 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"], shortcuts: localStorage["shortcuts"]});
else if (request.greeting == "donated")
localStorage["donated"] = "1";
else
View
@@ -11,7 +11,7 @@
*
*Source code at: http://github.com/codysherman/Scroll-to-Top-Button-Extension
*
-*Version: 5.0.2
+*Version: 6.1.0
-----------------------*/
// Checks to see if page is larger than window, otherwise runs watch();
if ((window == top) && ($(window).height()<$(document).height())) {
@@ -73,6 +73,7 @@ function STTB() {
var location = response.location;
var stbb = response.stbb;
var transparency = response.transparency;
+ var shortcuts = response.shortcuts;
// Assigns the correct arrow color to imgURL
if (stbb == "dual"){
@@ -293,12 +294,22 @@ function STTB() {
$("#STTBimg2").scrollToTop({speed:speed2, ease:scroll, start:distance, stbb:stbb, flipDistance:flipDistance, transparency:transparency, direction:"down"});
//Adds keyboard commands using shortcut.js
- shortcut.add("Alt+B", function() {
- DOWN(speed2, scroll);
- });
- shortcut.add("Alt+T", function() {
- UP(speed, scroll);
- });
+ if (shortcuts == "arrows") {
+ shortcut.add("Alt+Down", function() {
+ DOWN(speed2, scroll);
+ });
+ shortcut.add("Alt+Up", function() {
+ UP(speed, scroll);
+ });
+ }
+ else if (shortcuts == "tb") {
+ shortcut.add("Alt+B", function() {
+ DOWN(speed2, scroll);
+ });
+ shortcut.add("Alt+T", function() {
+ UP(speed, scroll);
+ });
+ }
shortcut.add("End", function() {
DOWN(speed2, scroll);
},{
@@ -42,12 +42,12 @@ function DOWN(speed,ease){
// Allows the button to change directions when in "Flip" mode on page load
if(o.stbb=="flip"){
if($(window).scrollTop()>=o.flipDistance){
- $("#STTBimg").rotateAnimation(0);
+ $("#STTBimg").rotate({animateTo:0});
o.direction="up";
};
if($(window).scrollTop()<"200"){
- $("#STTBimg").rotateAnimation(-180);
+ $("#STTBimg").rotate({animateTo:-180});
o.direction="down";
};
};
@@ -67,12 +67,12 @@ function DOWN(speed,ease){
if(o.stbb=="flip"){
if($(window).scrollTop()>=o.flipDistance){
- $("#STTBimg").rotateAnimation(0);
+ $("#STTBimg").rotate({animateTo:0});
o.direction="up";
};
if($(window).scrollTop()<o.flipDistance){
- $("#STTBimg").rotateAnimation(-180);
+ $("#STTBimg").rotate({animateTo:-180});
o.direction="down";
};
};
Oops, something went wrong.

0 comments on commit cf0ace7

Please sign in to comment.