Skip to content

Commit

Permalink
Merge pull request #24 from peckadesign/23-forceReload-hash
Browse files Browse the repository at this point in the history
#23 Extension `forceReload` rozbíjí url s hashem
  • Loading branch information
zipper authored Dec 2, 2020
2 parents 4ca782b + 6a7af26 commit 146b171
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Vlastní extensions pro nette.ajax

## Changelog
### 1.4.8
- Oprava chyby [#23](https://github.com/peckadesign/pd.ajax/issues/23), kdy extension `forceReload` v případě kombinace hashe a parametrů rozbíjelo URL.

### 1.4.7
- Extension `uniqueForm` je možno vypnout i na neeajaxových formulářích a to stejným způsobem, jako jinde, tj. pomocí `data-ajax-off="uniqueForm"` buď na formuláři, nebo na tlačítku. Řeší issue [#21](https://github.com/peckadesign/pd.ajax/issues/21).

Expand Down
24 changes: 19 additions & 5 deletions extensions/forceReload.ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,33 @@
}
}, {
addFid: function(href, _fid) {
var s = '?';
var hashStart = href.indexOf('#');
var hash = '';
var c = '?';

if (hashStart > -1) {
hash = href.substring(hashStart);
href = href.substring(0, hashStart);
}

if ((i = href.search(/\?/)) !== -1) {
s = '&';
c = '&';
}

href += s + '_fid=' + _fid;
href += c + '_fid=' + _fid;

return href;
return href + hash;
},
removeFid: function(href) {
// je v URL _fid?
var fidStart = href.indexOf('_fid=');
var hashStart = href.indexOf('#');
var hash = '';

if (hashStart > -1) {
hash = href.substring(hashStart);
href = href.substring(0, hashStart);
}

if (fidStart > -1) {
// Odstranění _fid parametru
Expand All @@ -53,7 +67,7 @@

}

return href;
return href + hash;
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pd.ajax",
"title": "pd.ajax",
"description": "Collection of nette ajax extensions, including `pd` for creating disabled-by-deafult extensions",
"version": "1.4.7",
"version": "1.4.8",
"author": "PeckaDesign, s.r.o <[email protected]>",
"contributors": [
"Radek Šerý <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion pd.ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @copyright Copyright (c) 2015 Jiří Pudil
* @license MIT
*
* @version 1.4.7
* @version 1.4.8
*/
(function ($, undefined) {
var extensions = {};
Expand Down

0 comments on commit 146b171

Please sign in to comment.