Unfortunately that won’t work in my setup as there are some CMS scripts
that I don’t have access to modify.
I was hoping that there might be a way to specify class IDs to ignore
within the head?
On Sat, Sep 8, 2018 at 9:52 PM BehindTheMath <notifications@github.com>
wrote:
> Use a global variable to store whether the scripts were run already, then
> check that value in your scripts.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/MoOx/pjax/issues/175#issuecomment-419688902>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/Ajr5sk3mqrLSip6WIvgWjdP6rgSd_c8Oks5uZJCBgaJpZM4WgIU4>
> .
>
For others who might be interested, I was able to put together a workaround by adding this line of code below:
loadContent: function(html, options) {
// ADDED below line to strip items with the 'no-pjax' class name from the HTML:
html = html.replace(/<.* class=(\'|\")no-pjax(\'|\")[^\0]*?\/.*>/g, '');
For others who might be interested, I was able to put together a workaround by adding this line of code below:
```
loadContent: function(html, options) {
// ADDED below line to strip items with the 'no-pjax' class name from the HTML:
html = html.replace(/<.* class=(\'|\")no-pjax(\'|\")[^\0]*?\/.*>/g, '');
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Hi,
Is there a way to set a selector on "head" but to prevent certain scripts from being re-run on a new page load?
Andrew
Use a global variable to store whether the scripts were run already, then check that value in your scripts.
Unfortunately that won’t work in my setup as there are some CMS scripts
that I don’t have access to modify.
I was hoping that there might be a way to specify class IDs to ignore
within the head?
On Sat, Sep 8, 2018 at 9:52 PM BehindTheMath notifications@github.com
wrote:
There's no built in way to do that. Your bet bet is to move the script tag outside of any elements affected by Pjax.
For others who might be interested, I was able to put together a workaround by adding this line of code below:
Re parsing HTML using regex. 😄