vgquotes/Src/VideoGameQuotes.Web/media/js/jquery.refresh.js
tmont 25172d14a3 * compressed javascript
* renamed css file
* removed copypaste code for js includes
* added pdn files
* changed unused images/javascript build type from Content to None
2011-03-01 00:11:17 +00:00

32 lines
918 B
JavaScript

/**
* (c) 2010 Tommy Montgomery
* http://tommymontgomery.com/stuff/snippets/javascript/javascript-refresh
* Licensed under WTFPL: http://sam.zoy.org/wtfpl/COPYING
*/
(function($, window){
var refreshCookie = "jquery.refresh.fragment";
var refresh = function() {
var url = window.location.href;
var fragmentPosition = url.lastIndexOf("#");
if (fragmentPosition >= 0) {
if (fragmentPosition !== url.length - 1) {
$.cookie(refreshCookie, url.substring(fragmentPosition + 1)); //store the fragment in a cookie
}
url = url.substring(0, fragmentPosition);
}
window.location.href = url;
};
var applyFragmentFromCookie = function() {
var fragment = $.cookie(refreshCookie);
if (fragment !== null) {
window.location.href += "#" + fragment;
$.cookie(refreshCookie, null); //delete cookie
}
};
$(document).ready(applyFragmentFromCookie);
$.refresh = refresh;
}(jQuery, window));