vojtech-dobes / history.nette.ajax.js Goto Github PK
View Code? Open in Web Editor NEWAdds History API support to nette.ajax.js addon!
Adds History API support to nette.ajax.js addon!
Hi, I have a problem with history. My steps:
So moving in history works as expected, but not with the oldest page (the page I load in normal way - not AJAX way).
Are the snippets from the oldest page saved in the history?
I would appreciate if I can decide weather the URL will be updated or not.
My scenario: I have ajax image gallery and each picture has delete icon (anchor with href to signal deleteImage!) hitting this button is properly ajax handled, image is deleted and snippet with gallery is redrawed and its fine but I ended up with URL containing &do=handleDeleteImage but I would like to have URL without this parameter. I can use redirect but I dont see any reason why.
Hi, when I add a hastag into redirect like this:
$this->redirect('Presenter:action#HASH');
the browser receives a correct url but wihout the #HASH. Found out the problem is caused be generating the url again here. After some debugging I discovered the method __invoke is called twice;
I need that hashtag to open a bootstrap modal so I've tried to workaround this by writing own extension that opens modals by showModal property in the payload but when I set it in a presenter like this:
$this->payload->showModal = 'ModalID';
$this->redirect('Presenter:action');
It doesn't work either. The browser receives only snippets and a wrong redirect.
After upgrading to iOS 10, there are this error
I'm getting ReflectionException
Property MyApplication::$httpRequest does not exist
in https://github.com/vojtech-dobes/history.nette.ajax.js/blob/master/src/OnResponseHandler.php#L67 How can I avoid it? Any idea why it's happening?
I'm using module-specific error presenters and sometimes I use forward method to send the exception from the module-specific ErrorPresenter to default one. However this triggers this line which fails to generate the link because Exception and Request are objects. I need this addon to ignore forwadding between to ErrorPresenter somehow. Not completely sure how though.
storing all snippets in cache might cause the HTML5 pushstate cache to overrun Firefox's 640k character limit.
Might it be better to use localStorage or sessionStorage for this cache, as Mozilla's documentation suggests?
Similar issue here
If I use sth. like this in presenter
$this->flashMessage('test');
$this->redirect('this');
the flash message will not show up as corresponding snippet (flashes) is not set to be redrawn after forwarding.
The workaround is to check for _fid in startup
method
if (!empty($this->params[self::FLASH_KEY])) {
$this->redrawControl('flashes');
}
but I lost more than hour to track this down..would be nice to mention this at least somewhere
When I hit back button in browser that goes to temporary accessible page such as some thankyou page which is no longer valid and I'm redirected somewhere, URL doesn't change due to this line.
What is the reason for disabling history extension for such cases? I've tried to remove this line and I'm not facing any issues. May I send PR?
A have a signal.
If I use $this->redirect('Article:default', ["id" => 22])
, it works.
But if I use $this->redirectUrl('/article/22')
, URL will change, but snippet doesn't reload.
The response contains only redirect: "/general/comment/22"
, nothing more.
Would be nice if we can ge master as it is now as new version so we don't have to depend on dev-master, and that we can throw away unnedded nette packages (specially nette/deprecated)
Ahoj,
mám problém, pokud vyprší session u uživatele, tak v baseSecuredPresenteru přesměrovávám na sign.in, url se mě změní, ale stránka se nerefreshne. Pokud zakomentuji přilinkování history.nette.ajax.js tak se stránka redirectne a vše funguje správně. Něco jsem o tom sepsal na nette foru
Je možnost nějak využívat jak tento addon, tak i redirect?
When using Firefox 26, there're two glitches.
1) TypeError: invalid 'in' operand window.history
[Break On This Error]
this.popped = !!('state' in window.history) && !!window.history.state;
After fixing this line to not use in
operand, another glitch occurs.
2) window.history is undefined
Is there any way you can make this work (at least graceful degradation)?
Thanks
Hi, what is the purpose of assigning redirect value to this.href? I've used old redirect function from nette.ajax and after session is expired, it was redirecting to login page. Now after implementation of history.nette.ajax, there is a problem, because it is not redirecting because of this condition.
if (redirect) {
var regexp = new RegExp('//' + window.location.host + '($|/)');
if ((redirect.substring(0,4) === 'http') ? regexp.test(redirect) : true) {
this.href = redirect;
} else {
window.location.href = redirect;
}
}
I'd like to use this package in stable version and last tag is from March.
Could I ask you to release new tag?
It looks that is not. But I would like to create some effect on page change, like slide. If it would be appended, I could hide new content and then slide it on the old one.
Or, maybe you know better how to create some effects, when snippet is loaded?
As known, Safari triggers popstate
event on window
after page has been loaded. Current detection of initialPop
(popstate not caused by history manipulation - back/forward button) works fine only for the first page load and traversing using links. But when the current page is refreshed, the initialPop
is not recognized and its value here is false.
Because of that, updateSnippets
function is called (via handleUI
from history extension) after refresh and some JS could break as the DOM changes (attached events are lost for instance). This happens only in Safari (specifically tested Safari 8.0.4 on OS X Yosemite, but the bug could be reproduced on El Capitan aswell) as no other browser triggers popstate
on page load.
history.ajax.js should trigger only on links pointing to different pages. So not signals or forms.
in config.neon
from:
extensions:
ajax-history: VojtechDobes\NetteAjax\HistoryExtension
to
extensions:
ajaxHistory: VojtechDobes\NetteAjax\HistoryExtension
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.