ajax_pagination 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/COPYING.LESSER ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ajax_pagination.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright © 2012 Ronald Ping Man Chan
2
+ If you want to use this program under a different license, please contact me.
3
+ All pull requests on GitHub will be assumed to assign non-exclusive rights for perpertual usage for any use whatsoever for those modifications to Ronald Ping Man Chan. If you do not have the power to assign that right, do not submit a pull request. This allows me to release the software under a more permissible license in the future, if I so wish.
4
+ Ronald
5
+
6
+ The software is released under LGPL. The LGPL License on this software means that this Gem can be used in any software (proprietary or otherwise), by using the gem command. However, the gem cannot be included directly in proprietary software (eg. as a plugin), without distributions of the software being under LGPL. Distribution of this Gem must be released under the LGPL as well.
7
+
8
+ This file is part of AJAX Pagination.
9
+
10
+ AJAX Pagination is free software: you can redistribute it and/or modify
11
+ it under the terms of the GNU Lesser General Public License as published by
12
+ the Free Software Foundation, either version 3 of the License, or
13
+ (at your option) any later version.
14
+
15
+ This program is distributed in the hope that it will be useful,
16
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ GNU Lesser General Public License for more details.
19
+
20
+ You should have received a copy of the GNU Lesser General Public License
21
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
data/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # AJAX Pagination
2
+ **TO BE RELEASED**
3
+
4
+ Handles AJAX pagination for you, by hooking up the links you want to load content with javascript in designated page containers. Each webpage can have multiple page containers, each with a different set of pagination links. The page containers can be nested. Degrades gracefully when javascript is disabled.
5
+
6
+ ## Introduction
7
+ This gem can ajaxify any pagination solution. Links wrapped in containers with specific classes will be ajaxified. This means that clicking it will instead send an AJAX request for the page in javascript format. The result will replace the content in a container for the content. this gem is tested to work for will_paginate, but should work for other pagination solutions, as well as navigation level links or tabbed interfaces. The ajax call will load new content into the designated content container.
8
+
9
+ ## Background
10
+ This gem depends on Rails 3.1+, jQuery and jquery-historyjs. The gem was extracted from http://github.com/xrymbos/nztrain-v2/, and further development will be tied to the needs of the application. Therefore, some dependencies are because the application uses a particular version of these other gems. If you need to use this in other versions/javascript frameworks, I would welcome any pull requests. They are not currently supported because I do not need to use this gem in those other frameworks.
11
+
12
+ The original AJAX pagination functionality was inspired by the RailsCasts on pagination with AJAX. However, other functionality was added to the pagination, add more modular code was desired, especially when many different controllers need pagination.
13
+
14
+ Because the code became more modular, it also made it suitable to turn into a Ruby Gem, so that others can create AJAX pagination without fiddling with the details.
15
+
16
+ Rails 3.1+ is required only because the javascript is placed into the assets pipeline.
17
+
18
+ ## Installation
19
+ Add to your Gemfile:
20
+
21
+ gem 'ajax_pagination'
22
+
23
+ and run the bundle install command.
24
+
25
+ Then add to your assets/javascripts/application.js,
26
+
27
+ ```javascript
28
+ //= require ajax_pagination
29
+ ```
30
+
31
+ ## Getting started
32
+
33
+ The pagination needs a name (in case you have multiple sets of AJAX pagination on the same webpage). By default, the name is "page". If you only intend to use a single set of pagination links, then leave it as "page".
34
+
35
+ Move the content to be paginated into a partial. If you are using the will_paginate gem (or similar), there is only one set of content to put into a partial. If you are using this to paginate between distinct views or even different controllers, you will need to move each set of content into a different partial.
36
+
37
+ By default, AJAX Pagination looks for the pagination content in the partial with filename matching the name of the pagination (by default "page"), so it is a good idea to use this name. If multiple views have pagination content in the same controller (especially if for the same pagination set), you will need to use different filenames for them.
38
+
39
+ Then, instead of the paginated content, put the following in your view:
40
+
41
+ ```erb
42
+ <%= ajax_pagination %>
43
+ ```
44
+
45
+ If the pagination name is not "page", pass the new pagination name in.
46
+
47
+ ```erb
48
+ <%= ajax_pagination :pagination => "page" %>
49
+ ```
50
+
51
+ If the partial is not named the same, pass it the new name as an option:
52
+
53
+ ```erb
54
+ <%= ajax_pagination :partial => "mypartial" %>
55
+ ```
56
+
57
+ This will case it to display content in the _mypartial.* view.
58
+
59
+ If you are using will_paginate, and the links are wrapped in a div with class="pagination", the links will be ajaxified automatically.
60
+
61
+ Otherwise, you should wrap the links with a container. We recommend that the class given is "ajaxpagination". For example:
62
+
63
+ ```html
64
+ <div class="ajaxpagination"><a href="#">My ajaxified link</a></div>
65
+ ```
66
+
67
+ If you are using will_paginate, you can simply put this in the partial (so that the new links get reloaded when the page changes):
68
+
69
+ ```erb
70
+ <%= will_paginate @objects, :params => { :pagination => nil } %>
71
+ ```
72
+
73
+ Note: It is recommended to set the pagination parameter to nil. When AJAX pagination calls the controller with a request for the partial, it appends ?pagination=NAMEOFPAGINATION. If the parameter is not set, AJAX Pagination will not respond to the AJAX call. will_paginate by default keeps any parameters in the query string. However, because this parameter is for internal use only, setting it to nil will keep the parameter from showing up in the url, making it look nicer (also better for caching).
74
+
75
+ Now, AJAX pagination will automatically call the controller for new content when an ajaxified link is clicked.
76
+
77
+ However, the controller needs to be told how to respond. Add a call to ajax_pagination(format) in the controller action, which will return javascript containing the partial.
78
+
79
+ ```ruby
80
+ respond_to do |format|
81
+ format.html # index.html.erb
82
+ ajax_pagination(format)
83
+ end
84
+ ```
85
+
86
+ If either the pagination name or the partial filename is not the default, you will need to pass these in as options.
87
+
88
+ ```ruby
89
+ ajax_pagination format, :pagination => "page", :partial => "mypartial"
90
+ ```
91
+
92
+ The pagination should now work.
93
+
94
+ AJAX Pagination can also add a loading image and partially blanking out of the paginated content. To do this, wrap all the content you want to cover with ajax_pagination_loadzone. For example, in the partial, you might have:
95
+
96
+ ```erb
97
+ <%= will_paginate @objects, :params => { :pagination => nil } %>
98
+ <%= ajax_pagination_loadzone do %>
99
+ All content here is covered by a semi-transparent white rectangle.
100
+ A loading image is displayed on top, and any links here are unclickable
101
+ <% end %>
102
+ ```
103
+
104
+ Links outside are still clickable (such as the will_paginate links).
105
+
106
+ The loading image is currently an image asset at "ajax-loader.gif", so put your loading image there. (TODO: add default loader image, and make the location changeable)
107
+
108
+ ## Javascript Dependency
109
+ As well as the included ajax_pagination.js file, this gem uses jquery.ba-bbq.js, a jquery plugin. This is included in the gem as an asset already to simplify installation. ajax_pagination.js will automatically require jquery.ba-bbq.js.
110
+
111
+ However, if you are already using this (especially a different version of this), simply ensure that your file is named jquery.ba-bbq.js as well, so that it overrides the file in the gem.
112
+
113
+ ## Development
114
+ You are welcome to submit pull requests on GitHub at https://github.com/ronalchn/ajax_pagination, however, please be aware that submitting a pull request is assumed to grant non-exclusive, perpetual rights to the use of the software for any use whatsoever. This allows me to release the software under a more permissible license in the future if I want.
115
+
116
+ If you do not submit a pull request, your modifications will not be merged into the codebase.
117
+
118
+ ## License
119
+ Copyright © 2012 Ronald Ping Man Chan
120
+ If you want to use this program under a different license, please contact me.
121
+ All pull requests to my repository will be assumed to assign non-exclusive rights for perpertual usage for any use whatsoever for those modifications to Ronald Ping Man Chan. If you do not have the power to assign that right, do not submit a pull request. This allows me to release the software under a more permissible license in the future if I want.
122
+ Ronald
123
+
124
+ The software is released under LGPL. The LGPL License on this software means that this Gem can be used in any software (proprietary or otherwise), by using the gem command. However, the gem cannot be included directly in proprietary software (eg. as a plugin), without distributions of the software being under LGPL. Distribution of this Gem must be released under the LGPL as well.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "ajax_pagination/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ajax_pagination"
7
+ s.version = AjaxPagination::VERSION
8
+ s.authors = ["Ronald Ping Man Chan"]
9
+ s.email = ["ronalchn@gmail.com"]
10
+ s.homepage = "https://github.com/ronalchn/ajax_pagination"
11
+ s.summary = %q{Handles AJAX pagination, changing the content when certain links are followed.}
12
+ s.description = %q{Handles AJAX pagination for you, by hooking up the links you want to load content with javascript in designated page containers. Each webpage can have multiple page containers, each with a different set of pagination links. The page containers can be nested. Degrades gracefully when javascript is disabled.}
13
+
14
+ s.rubyforge_project = "ajax_pagination"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+
25
+ s.add_runtime_dependency "rails", '>= 3.1'
26
+ s.add_runtime_dependency "jquery-rails", '>= 1.0'
27
+ s.add_runtime_dependency "jquery-historyjs"
28
+
29
+ end
@@ -0,0 +1,7 @@
1
+ require "ajax_pagination/version"
2
+ require "ajax_pagination/controller_additions"
3
+ require "ajax_pagination/helper_additions"
4
+ require "ajax_pagination/rails"
5
+
6
+ module AjaxPagination
7
+ end
@@ -0,0 +1,19 @@
1
+ module AjaxPagination
2
+ module ControllerAdditions
3
+ def ajax_pagination(format,options = {})
4
+ if params[:pagination] == (options[:pagination] || 'page')
5
+ partial = options[:partial] || params[:pagination]
6
+ format.js { render :inline => "ajaxPagination.display_pagination_content(\"#{params[:pagination]}\",\"#{request.url}\",\"<%= raw escape_javascript(render(\"#{partial}\")) %>\");" }
7
+ return true
8
+ else
9
+ return false
10
+ end
11
+ end
12
+ end
13
+ end
14
+ if defined? ActionController
15
+ ActionController::Base.class_eval do
16
+ include AjaxPagination::ControllerAdditions
17
+ end
18
+ end
19
+
@@ -0,0 +1,30 @@
1
+ module AjaxPagination
2
+ module HelperAdditions
3
+ def ajax_pagination(options = {})
4
+ pagination = options[:pagination] || 'page' # by default the name of the pagination is 'page'
5
+ partial = options[:partial] || pagination # default partial rendered is the name of the pagination
6
+ reload = options[:reload]
7
+ divoptions = { :id => "#{pagination}_paginated_section", :class => "paginated_section" }
8
+ case reload.class.to_s
9
+ when "String"
10
+ divoptions["data-reload"] = reload
11
+ when "Hash", "Array"
12
+ divoptions["data-reload"] = reload.to_json
13
+ end
14
+ content_tag :div, divoptions do
15
+ render partial
16
+ end
17
+ end
18
+ def ajax_pagination_loadzone()
19
+ content_tag :div, :class => "paginated_content", :style => "position: relative" do
20
+ yield
21
+ end
22
+ end
23
+ end
24
+ end
25
+ if defined? ActionView
26
+ ActionView::Base.class_eval do
27
+ include AjaxPagination::HelperAdditions
28
+ end
29
+ end
30
+
@@ -0,0 +1,4 @@
1
+ module AjaxPagination
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module AjaxPagination
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,100 @@
1
+ //= require jquery.ba-bbq
2
+
3
+ if (History && History.enabled) {
4
+ var ajaxPagination;
5
+ $(document).ready(function () {
6
+ ajaxPagination = new function() {
7
+ this.pagination_loader_state = new Array(); // the page we are waiting for
8
+ //this.pagination_stack = new Array(); // stack of request urls in history (to get state of url we came from)
9
+ this.pagination_url = location.href; // url we came from, so we can see transitions of the url
10
+
11
+ function display_pagination_loader(pagination_name) {
12
+ if (this.pagination_loader_state[pagination_name] != undefined) return; // if already loading, don't reshow loader
13
+ var paginated_section = $('#' + pagination_name + '_paginated_section');
14
+ var paginated_content = paginated_section.children(".paginated_content").first(); // don't want to support multiple loader images
15
+ var height = paginated_content.height();
16
+ // setup loading look
17
+ var img = document.createElement("IMG");
18
+ img.src = "<%= asset_path "ajax-loader.gif" %>";
19
+ var margin = Math.round(height>400?100:(height/4));
20
+ $(img).css({'margin': margin + 'px', 'max-height': (height/2) + 'px'});
21
+ var div = document.createElement("DIV");
22
+ $(div).append(img);
23
+ $(div).css({'position': 'absolute', 'left': 0, 'top': 0, 'width': '100%', 'height': '100%', 'background-color': 'rgba(255,255,255,0.7)', 'text-align': 'center', 'opacity': 0.9});
24
+ paginated_content.append(div);
25
+
26
+ // scroll to top of paginated_section if it is not visible
27
+ if ($('body').scrollTop() > paginated_section.offset().top) {
28
+ $('body').scrollTop(paginated_section.offset().top);
29
+ }
30
+ }
31
+
32
+ this.display_pagination_content = function(pagination_name,requesturl,content) {
33
+ if (this.pagination_loader_state[pagination_name] == requesturl) {
34
+ //pagination_content_state[pagination_name] = pagination_loader_state[pagination_name];
35
+ delete this.pagination_loader_state[pagination_name]; // not waiting for page anymore
36
+ $("#" + pagination_name + "_paginated_section").html(content);
37
+ }
38
+ // else content is stale
39
+ };
40
+
41
+ function swapPage(pagination_name,requesturl) { // swaps the page at pagination_name to that from requesturl
42
+ display_pagination_loader.call(this,pagination_name);
43
+ this.pagination_loader_state[pagination_name] = requesturl; // remember which page number we are waiting for
44
+ $.ajax(requesturl,{dataType:'script',cache:true});
45
+ }
46
+ $('body').on("click", ".pagination a, .ajaxpagination a", function() {
47
+ var pagination_name = /^(.*)_paginated_section$/.exec($(this).closest(".paginated_section").attr("id"))[1];
48
+ if (pagination_name == null) return; // pagination not set up properly
49
+ var requesturl = $.param.querystring(this.href,{pagination:pagination_name}); // by default, adds ?pagination=page
50
+ swapPage.call(ajaxPagination,pagination_name,requesturl);
51
+ ajaxPagination.pagination_url = this.href;
52
+ History.pushState(null,document.title,this.href);
53
+ return false;
54
+ });
55
+
56
+ History.Adapter.bind(window,'popstate',function(){ // popstate, but can work with hash changes as well
57
+ var from = ajaxPagination.pagination_url, to = location.href; // from what state to what other state
58
+
59
+ $(".paginated_section").each(function(){
60
+ var pagination_name = /^(.*)_paginated_section$/.exec($(this).attr("id"))[1];
61
+ if (pagination_name == null) return; // pagination not set up properly
62
+
63
+ // if data-reload is not defined, the use default reload test
64
+ if ($(this).data('reload') === undefined) {
65
+ // if ?pagination_name=ABC, where ABC is the same for both urls, then don't need to reload
66
+ if ($.deparam.querystring(from)[pagination_name] === $.deparam.querystring(to)[pagination_name]) return;
67
+ }
68
+ else { // otherwise parse json and perform tests
69
+ var reload = $(this).data('reload');
70
+ if (!(reload instanceof Array)) reload = new Array(reload);
71
+ var changed = false;
72
+ for (i=0;i<reload.length;i++) {
73
+ if (reload[i].query !== undefined) {
74
+ if ($.deparam.querystring(from)[reload[i].query] !== $.deparam.querystring(to)[reload[i].query]) changed = true;
75
+ }
76
+ if (reload[i].urlregex !== undefined) {
77
+ var index = 0;
78
+ if (reload[i].regexindex !== undefined) index = reload[i].regexindex;
79
+ var regex = new RegExp(reload[i].urlregex);
80
+ var frommatch = regex.exec(from), tomatch = regex.exec(to);
81
+ if (frommatch != null && frommatch.length>=index) frommatch = frommatch[index];
82
+ if (tomatch != null && tomatch.length>=index) tomatch = tomatch[index];
83
+ if (frommatch !== tomatch) changed = true;
84
+ }
85
+ if (changed) break;
86
+ }
87
+ if (!changed) return; // otherwise it has changed, and we must reload
88
+ }
89
+ var requesturl = $.param.querystring(location.href,{pagination:pagination_name}); // by default, adds ?pagination=page
90
+ swapPage.call(ajaxPagination,pagination_name,requesturl);
91
+ });
92
+
93
+ ajaxPagination.pagination_url = location.href; // update url (new url recognised)
94
+ });
95
+
96
+ //History.Adapter.trigger(window,"popstate"); // update stuff on page load
97
+ };
98
+ });
99
+ }
100
+