Built files from Bizgaze WebServer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sammy.push_location_proxy-latest.min.js 1.0KB

12345
  1. // -- Sammy.js -- /plugins/sammy.push_location_proxy.js
  2. // http://sammyjs.org
  3. // Version: 0.7.6
  4. // Built: 2014-08-26 10:45:33 +0300
  5. (function(factory){if(typeof define==="function"&&define.amd){define(["jquery","sammy"],factory)}else{(window.Sammy=window.Sammy||{}).PushLocationProxy=factory(window.jQuery,window.Sammy)}})(function($,Sammy){Sammy.PushLocationProxy=function(app,selector){this.app=app;this.selector=selector||"a"};$.extend(Sammy.PushLocationProxy.prototype,{bind:function(){var proxy=this;$(window).bind("popstate",function(e){proxy.app.trigger("location-changed")});this.app.$element().on("click",this.selector,function(e){if(location.hostname==this.hostname){e.preventDefault();proxy.setLocation($(this).attr("href"));proxy.app.trigger("location-changed")}})},unbind:function(){this.app.$element().off("click",this.selector);$(window).unbind("popstate")},getLocation:function(){return window.location.pathname},setLocation:function(new_location){history.pushState({path:this.path},"",new_location)}});return Sammy.PushLocationProxy});