[extensions-web: 26/30] paginator: Remove hashChanged and just rely on string comparison
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web: 26/30] paginator: Remove hashChanged and just rely on string comparison
- Date: Thu, 26 Jan 2012 10:42:42 +0000 (UTC)
commit 3246eeb1b4be886ca4414b1f9d0d23adcef25d34
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jan 12 16:58:19 2012 -0500
paginator: Remove hashChanged and just rely on string comparison
The case where we have different hash parameters but the same hash
string is extremely unlikely, and it doesn't cost the code complexity
for an extra HTTP request
sweettooth/static/js/paginator.js | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/sweettooth/static/js/paginator.js b/sweettooth/static/js/paginator.js
index cafddd8..504a2e7 100644
--- a/sweettooth/static/js/paginator.js
+++ b/sweettooth/static/js/paginator.js
@@ -97,27 +97,14 @@ define(['jquery', 'hashparamutils', 'jquery.hashchange'], function($, hashparamu
return $('<div>', {'class': 'paginator'}).append($elem);
}
- function hashChanged(hp) {
- if (hashParams.sort !== hp.sort)
- return true;
-
- if (hashParams.page !== hp.page)
- return true;
-
- return false;
- }
-
$(window).hashchange(function() {
- var hp = hashparamutils.getHashParams();
- if (hp.page === undefined)
- hp.page = 1;
+ hashParams = hashparamutils.getHashParams();
+ if (hashParams.page === undefined)
+ hashParams.page = 1;
else
- hp.page = parseInt(hp.page);
+ hashParams.page = parseInt(hashParams.page);
- if (hashChanged(hp)) {
- hashParams = hp;
- loadPage();
- }
+ loadPage();
});
$(window).hashchange();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]