wiselinks 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/build/{wiselinks-0.7.1.js → wiselinks-0.7.2.js} +2 -2
- data/build/{wiselinks-0.7.1.min.js → wiselinks-0.7.2.min.js} +9 -9
- data/build/wiselinks-0.7.2.min.js.gz +0 -0
- data/lib/assets/javascripts/_page.js.coffee +1 -4
- data/lib/wiselinks/version.rb +1 -1
- metadata +7 -7
- data/build/wiselinks-0.7.1.min.js.gz +0 -0
data/Gemfile.lock
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Wiselinks-0.7.
|
2
|
+
* Wiselinks-0.7.2
|
3
3
|
* @copyright 2012-2013 Igor Alexandrov, Alexey Solilin, Julia Egorova, Alexandr Borisov
|
4
4
|
* @preserve https://github.com/igor-alexandrov/wiselinks
|
5
5
|
*/
|
@@ -154,7 +154,7 @@
|
|
154
154
|
self._try_target(this.$target);
|
155
155
|
if (History.emulated.pushState && this.options.html4 === true) {
|
156
156
|
if (window.location.href.indexOf('#!') === -1 && this.options.html4_normalize_path === true && window.location.pathname !== this.options.html4_root_path) {
|
157
|
-
window.location.href = "" + window.location.protocol + "//
|
157
|
+
window.location.href = "" + window.location.protocol + "//" + window.location.host + this.options.html4_root_path + "#!" + window.location.pathname;
|
158
158
|
}
|
159
159
|
if (window.location.hash.indexOf('#!') !== -1) {
|
160
160
|
self._call(self._make_state(window.location.hash.substring(2)));
|
@@ -18,15 +18,15 @@
|
|
18
18
|
this.$form.data("push")?"partial":"template"};c.prototype._target=function(){return this.$form.data("target")};c.prototype._url=function(){var d,e,b;var f;if(this._optimize_url_params()){e=[];f=this._params();for(d in f)b=f[d],e.push(""+d+"="+encodeURIComponent(b));d=e.join("&")}else d=this.$form.serialize();e=this.$form.attr("action");0<d.length&&(e+="?"+d);return e};return c}();null==window._Wiselinks&&(window._Wiselinks={});window._Wiselinks.Form=c;c=function(){function c(d,e){this.page=d;this.$link=
|
19
19
|
e}c.prototype.allows_process=function(d){return!(this._cross_origin_link(d.currentTarget)||this._non_standard_click(d))};c.prototype.process=function(){var d;d="partial"===this.$link.data("push")?"partial":"template";return this.page.load(this.$link.attr("href"),this.$link.data("target"),d)};c.prototype._cross_origin_link=function(d){return location.protocol!==d.protocol||location.port!==d.port||location.host.split(":")[0]!==d.host.split(":")[0]};c.prototype._non_standard_click=function(d){return d.metaKey||
|
20
20
|
d.ctrlKey||d.shiftKey||d.altKey};return c}();void 0===window._Wiselinks&&(window._Wiselinks={});window._Wiselinks.Link=c;c=function(){function c(d,e){var b;this.$target=d;this.options=e;b=this;this.template_id=(new Date).getTime();this.request_manager=new _Wiselinks.RequestManager(this.options);b._try_target(this.$target);History.emulated.pushState&&!0===this.options.html4&&(-1===window.location.href.indexOf("#!")&&(!0===this.options.html4_normalize_path&&window.location.pathname!==this.options.html4_root_path)&&
|
21
|
-
(window.location.href=""+window.location.protocol+"//
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
(window.location.href=""+window.location.protocol+"//"+window.location.host+this.options.html4_root_path+"#!"+window.location.pathname),-1!==window.location.hash.indexOf("#!")&&b._call(b._make_state(window.location.hash.substring(2))));History.Adapter.bind(window,"statechange",function(d,e){var c;c=History.getState();return b._template_id_changed(c)?b._call(b._reset_state(c)):b._call(c)});$(document).on("click","a[data-push], a[data-replace]",function(d){var e;if((e=new _Wiselinks.Link(b,$(this))).allows_process(d))return d.preventDefault(),
|
22
|
+
e.process(),!1});$(document).on("submit","form[data-push], form[data-replace]",function(d){var e;if(e=new _Wiselinks.Form(b,$(this)))return d.preventDefault(),e.process(),!1})}c.prototype.load=function(d,e,b){null==b&&(b="template");"partial"!==b&&(this.template_id=(new Date).getTime());null!=e&&this._try_target($(e));return History.pushState({timestamp:(new Date).getTime(),template_id:this.template_id,render:b,target:e,referer:window.location.href},document.title,d)};c.prototype.reload=function(){return History.replaceState({timestamp:(new Date).getTime(),
|
23
|
+
template_id:this.template_id,render:"template",referer:window.location.href},document.title,History.getState().url)};c.prototype._call=function(d){var e;e=null!=d.data.target?$(d.data.target):this.$target;return this.request_manager.call(e,d)};c.prototype._template_id_changed=function(d){return null==d.data.template_id||d.data.template_id!==this.template_id};c.prototype._make_state=function(d,e,b,f){null==b&&(b="template");return{url:d,data:{target:e,render:b,referer:f}}};c.prototype._reset_state=
|
24
|
+
function(d){null==d.data&&(d.data={});d.data.target=null;d.data.render="template";return d};c.prototype._try_target=function(d){if(0===d.length&&"exception"===this.options.target_missing)throw Error("[Wiselinks] Target missing: `"+d.selector+"`");};return c}();void 0===window._Wiselinks&&(window._Wiselinks={});window._Wiselinks.Page=c;c=function(){function c(d){this.options=null!=d?d:{}}c.prototype.call=function(d,c){var b;b=this;if(null!=this.redirected)this.redirected=null;else return b._loading(d,
|
25
|
+
c),$.ajax({url:c.url,headers:{"X-Wiselinks":c.data.render,"X-Wiselinks-Referer":c.data.referer},dataType:"html"}).done(function(f,g,k){var l,h;h=b._normalize(k.getResponseHeader("X-Wiselinks-Url"));l=k.getResponseHeader("X-Wiselinks-Assets-Digest");if(b._assets_changed(l))return window.location.reload(!0);c=History.getState();null!=h&&h!==encodeURI(b._normalize(c.url))&&b._redirect_to(h,d,c,k);d.html(f);b._title(k.getResponseHeader("X-Wiselinks-Title"));return b._done(d,g,c.url,f)}).fail(function(f,
|
26
|
+
g,k){return b._fail(d,g,c.url,k)}).always(function(f,g,k){return b._always(d,g,c.url)})};c.prototype._normalize=function(d){if(null!=d)return d=d.replace(/\/+$/,"")};c.prototype._assets_changed=function(d){return null!=this.options.assets_digest&&this.options.assets_digest!==d};c.prototype._redirect_to=function(d,c,b,f){f&&4>f.readyState&&(f.onreadystatechange=$.noop,f.abort());this.redirected=!0;$(document).trigger("page:redirected",[c,b.data.render,d]);return History.replaceState(b.data,document.title,
|
27
|
+
d)};c.prototype._loading=function(d,c){return $(document).trigger("page:loading",[d,c.data.render,c.url])};c.prototype._done=function(d,c,b,f){return $(document).trigger("page:done",[d,c,b,f])};c.prototype._fail=function(d,c,b,f){return $(document).trigger("page:fail",[d,c,b,f])};c.prototype._always=function(d,c,b){return $(document).trigger("page:always",[d,c,b])};c.prototype._title=function(d){if(null!=d)return $(document).trigger("page:title",decodeURI(d)),document.title=decodeURI(d)};return c}();
|
28
|
+
void 0===window._Wiselinks&&(window._Wiselinks={});window._Wiselinks.RequestManager=c;c=function(){function c(d,e){null==d&&(d=$("body"));this.options=null!=e?e:{};this._try_jquery();this.options=$.extend(this._defaults(),this.options);this.enabled()&&(this.page=new _Wiselinks.Page(d,this.options))}c.prototype.enabled=function(){return!History.emulated.pushState||!0===this.options.html4};c.prototype.load=function(c,e,b){null==b&&(b="template");return this.page.load(c,e,b)};c.prototype.reload=function(){return this.page.reload()};
|
29
|
+
c.prototype._defaults=function(){return{html4:!0,html4_root_path:"/",html4_normalize_path:!0,target_missing:null,assets_digest:$("meta[name='assets-digest']").attr("content")}};c.prototype._try_jquery=function(){if(null==window.jQuery)throw Error("[Wiselinks] jQuery is not loaded");};return c}();window.Wiselinks=c}).call(this);
|
30
30
|
(function(c,q){var d=c.History=c.History||{},e=c.jQuery;if("undefined"!==typeof d.Adapter)throw Error("History.js Adapter has already been loaded...");d.Adapter={bind:function(b,c,d){e(b).bind(c,d)},trigger:function(b,c,d){e(b).trigger(c,d)},extractEventData:function(b,c,d){return c&&c.originalEvent&&c.originalEvent[b]||d&&d[b]||q},onDomLoad:function(b){e(b)}};"undefined"!==typeof d.init&&d.init()})(window);
|
31
31
|
(function(c,q){var d=c.document,e=c.setInterval||e,b=c.History=c.History||{};if("undefined"!==typeof b.initHtml4)throw Error("History.js HTML4 Support has already been loaded...");b.initHtml4=function(){if("undefined"!==typeof b.initHtml4.initialized)return!1;b.initHtml4.initialized=!0;b.enabled=!0;b.savedHashes=[];b.isLastHash=function(c){var d=b.getHashByIndex();return c===d};b.saveHash=function(c){if(b.isLastHash(c))return!1;b.savedHashes.push(c);return!0};b.getHashByIndex=function(c){var d=null;
|
32
32
|
return d="undefined"===typeof c?b.savedHashes[b.savedHashes.length-1]:0>c?b.savedHashes[b.savedHashes.length+c]:b.savedHashes[c]};b.discardedHashes={};b.discardedStates={};b.discardState=function(c,d,e){var l=b.getHashByState(c);b.discardedStates[l]={discardedState:c,backState:e,forwardState:d};return!0};b.discardHash=function(c,d,e){b.discardedHashes[c]={discardedHash:c,backState:e,forwardState:d};return!0};b.discardedState=function(c){c=b.getHashByState(c);return b.discardedStates[c]||!1};b.discardedHash=
|
Binary file
|
@@ -14,10 +14,7 @@ class Page
|
|
14
14
|
@options.html4_normalize_path == true &&
|
15
15
|
window.location.pathname != @options.html4_root_path
|
16
16
|
|
17
|
-
window.location.href = "#{window.location.protocol}
|
18
|
-
#{window.location.host}
|
19
|
-
#{@options.html4_root_path}#!
|
20
|
-
#{window.location.pathname}"
|
17
|
+
window.location.href = "#{window.location.protocol}//#{window.location.host}#{@options.html4_root_path}#!#{window.location.pathname}"
|
21
18
|
|
22
19
|
if window.location.hash.indexOf('#!') != -1
|
23
20
|
self._call(self._make_state(window.location.hash.substring(2)))
|
data/lib/wiselinks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wiselinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-07-
|
15
|
+
date: 2013-07-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rspec
|
@@ -302,9 +302,9 @@ files:
|
|
302
302
|
- README.md
|
303
303
|
- Rakefile
|
304
304
|
- app/views/layouts/wiselinks.html.erb
|
305
|
-
- build/wiselinks-0.7.
|
306
|
-
- build/wiselinks-0.7.
|
307
|
-
- build/wiselinks-0.7.
|
305
|
+
- build/wiselinks-0.7.2.js
|
306
|
+
- build/wiselinks-0.7.2.min.js
|
307
|
+
- build/wiselinks-0.7.2.min.js.gz
|
308
308
|
- compiler.jar
|
309
309
|
- lib/assets/javascripts/_form.js.coffee
|
310
310
|
- lib/assets/javascripts/_link.js.coffee
|
@@ -406,7 +406,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
406
406
|
version: '0'
|
407
407
|
segments:
|
408
408
|
- 0
|
409
|
-
hash: -
|
409
|
+
hash: -1371171981664883558
|
410
410
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
411
411
|
none: false
|
412
412
|
requirements:
|
@@ -415,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
415
415
|
version: '0'
|
416
416
|
segments:
|
417
417
|
- 0
|
418
|
-
hash: -
|
418
|
+
hash: -1371171981664883558
|
419
419
|
requirements: []
|
420
420
|
rubyforge_project:
|
421
421
|
rubygems_version: 1.8.24
|
Binary file
|