Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update the icons etc to use propper urls

  • Loading branch information...
commit 4a0b666de6c4ca077351abb73733c94fc64a5770 1 parent 6ee3067
Pete Hawkins phawk authored
Showing with 48 additions and 8 deletions.
  1. +12 −5 chrome/source/pull_to_refresh.js
  2. +36 −3 chrome/source/styles.css
17 chrome/source/pull_to_refresh.js
View
@@ -2,13 +2,17 @@
var pullToReload = {
+ // Instance vars
refreshCapable: false,
timeStarted: null,
+ scrollUpTime: null,
init: function () {
+
// Inject the html onto the page
- $('body').prepend('<div id="pullToRefresh"><div class="wrap"><span class="icon">&nbsp;</span><div id="pullyText">Pull to refresh</div></div></div>');
- console.log('pull to reload init');
+ $('body').prepend('<div id="pullToRefreshReloading"><span class="icon"></span><span class="text">Reloading...</span></div><div id="pullToRefresh"><div class="wrap"><span class="icon">&nbsp;</span><div id="pullyText">Pull to refresh</div></div></div>');
+
+ // Bind scroll listener
$(window).bind('scroll', pullToReload.monitorScroll);
},
@@ -19,6 +23,7 @@ var pullToReload = {
{
// Set the text to pull to refresh
$("#pullToRefresh #pullyText").html("Pull to refresh");
+ $("#pullToRefresh .icon").removeClass("release");
// Set the position of the pull down bar
$("#pullToRefresh").css({ top: Math.abs(window.scrollY) - 40 });
@@ -33,8 +38,9 @@ var pullToReload = {
// Reload threshold has passed
if (window.scrollY <= -40)
{
- // Set the text to release
+ // Set the text and icon to release
$("#pullToRefresh #pullyText").html("Release to refresh");
+ $("#pullToRefresh .icon").addClass("release");
// Set the position incase we scrolled too fast
$("#pullToRefresh").css({ top: 0 });
@@ -54,7 +60,7 @@ var pullToReload = {
var nowTime = new Date(),
diff = nowTime.getTime() - pullToReload.timeStarted.getTime();
- // If we have taken less than a second for the release, reload the page
+ // If we have taken less than a half second for the release, reload the page
if (diff < 500) {
pullToReload.reloadTheWeePageMate();
}
@@ -65,8 +71,9 @@ var pullToReload = {
pullToReload.reloadTheWeePageMate();
}
- // Set the time back to null
+ // Set the time back to null and set release capable back to false
pullToReload.timeStarted = null;
+ pullToReload.refreshCapable = false;
}
if (window.scrollY >= 0)
39 chrome/source/styles.css
View
@@ -32,7 +32,7 @@
}
#pullToRefresh .icon{
- background: url('chrome-extension://lpjlpldmbikhdbmhhpippfhoifdhbbdh/whiteArrow.png');
+ background: url('chrome-extension://__MSG_@@extension_id__/whiteArrow.png');
float: right;
display: block;
width: 20px;
@@ -63,12 +63,45 @@
}
}
-#pullToRefresh.fixed .icon{
- background: url('chrome-extension://lpjlpldmbikhdbmhhpippfhoifdhbbdh/spinner.png');
+#pullToRefreshReloading .icon{
+ background: url('chrome-extension://__MSG_@@extension_id__/spinner.png');
+ float: right;
+ display: block;
+ width: 20px;
+ height: 20px;
+ color: #fff;
+ font-size: 20px;
+ line-height: 20px;
+ text-align: center;
text-indent: -10000px;
+ margin: 10px;
-webkit-animation-name: rotate;
-webkit-animation-duration: 0.5s;
-webkit-animation-iteration-count: infinite;
-webkit-transition-timing-function: linear;
-webkit-transform: rotate(0deg);
+}
+
+/* Reloading box */
+#pullToRefreshReloading{
+ position: fixed;
+ top: 200px;
+ left: 50%;
+ width: 160px;
+ margin-left: -100px;
+ background: rgba(0,0,0,0.8);
+ border-radius: 5px;
+ padding: 20px;
+ min-height: 40px;
+ z-index: 100010;
+}
+
+#pullToRefreshReloading .text{
+ width: 120px;
+ display: block;
+ color: #fff;
+ line-height: 40px;
+ font-size: 16px;
+ font-family: 'Helvetica Neue', Helvetica, sans-serif;
+ text-shadow: 1px 1px 0px rgba(0,0,0,0.8);
}
Please sign in to comment.
Something went wrong with that request. Please try again.