Coder Social home page Coder Social logo

falsandtru / pjax-api Goto Github PK

View Code? Open in Web Editor NEW
317.0 26.0 30.0 6.53 MB

The advanced PJAX superior to SPA.

Home Page: https://falsandtru.github.io/pjax-api/

License: Apache License 2.0

HTML 4.14% CSS 8.11% JavaScript 2.63% TypeScript 85.08% Ruby 0.04%
pjax pushstate router mpa spa

pjax-api's Introduction

PJAX

CI

The advanced PJAX superior to SPA.

The pjax-api can implement SPA on Pjax less expensive than SPA frameworks. And provides almost complete original web experience. Most SPA frameworks and pjax libraries lack many essential functions to keep the original web experience such as follows.

  • Browser history fix (Fix for browsers)
    • Browsers set the wrong title to the current URL in page back/forward.
  • Scroll position restoration (Fix for browsers)
    • Browsers cannot restore the scroll position if the current content doesn't have sufficient scroll size.
  • Unexpected scroll prevention (Fix for browsers)
    • Browsers unexpectedly scroll the page before updating the page in page back/forward.
  • Scroll behaviors around hash links
    • Most frameworks and libraries reproduce wrong scroll behaviors around hash links.
  • Scroll position after reloading
    • Most frameworks break the current scroll position after reloading.

Properties

Pjax is a low-level API for SPA easier, simpler, and less expensive than high-level APIs of SPA frameworks.

// SPA on Pjax
import Pjax, { FakeXMLHttpRequest } from 'pjax-api';

new Pjax({
  fetch: {
    rewrite: url =>
      FakeXMLHttpRequest.create(
        url,
        fetch(url, { headers: { 'Content-Type': 'application/json' } })
          .then(res => res.json())
          .then(data =>
            new DOMParser().parseFromString(
              `<title>${data.title}</title><body>${data.body}</body>`,
              'text/html'))),
  },
});
SPA on frameworks*1 SPA on Pjax
Type Framework Library
Abstraction level High Low
Original template language Yes No
Intermediate layer Yes No
Data format JSON JSON or anything*2
UX integrity*3 Low High
Technical property Exclusive Coexistence
Ecosystem Dedicated Common
Old servers Dispose Keep
New servers Required Optional
Work on servers Redevelop all Add JSON APIs*4
Work on clients Redevelop all Reconstruct scripts*5
Partial introduction Coarse Fine
Location Servers and Clients Clients
Server constraints Strong Nothing
Dependence High Low
Learning costs High Low
Development costs High Low
Operation costs High Low
Running costs High Low
Removal costs High Low
Renewal costs High Low

*1 Such as React.
*2 You can send any efficient format instead of JSON and parse it on clients.
*3 Between MPA(standard web sites) and SPA.
*4 Just do it.
*5 To manage the lifetime of existing scripts. Since such management doesn't depend on SPA, these scripts are sharable and reusable with MPA and other SPA libraries.

SPA frameworks are cancer of the web.

Features

Feature defunkt Turbolinks falsandtru Barba
SPA on Pjax (Use JSON instead of HTML)
Multiple area update
Fallback area matching
Shadow DOM support
Content type verification
HEAD contents markless auto sync
CSS markless auto sync
Script markless auto load
External script load
Inline script execution
Execution sequence keeping
Non-blocking script load
Subresource integrity verification *1
Rewrite request and response (XHR)
Rewrite source document
Concurrent sequence integration
URL scope
Browser history fix
Scroll position restoration
Unexpected scroll prevention
NOSCRIPT tag fix
History API support*2
No jQuery dependency

*1 Excludes ES modules.
*2 Ability to use pjax APIs and history APIs in combination.

Documents

https://falsandtru.github.io/pjax-api

Install

CDN

https://www.jsdelivr.com/package/npm/pjax-api

npm

$ npm i pjax-api

Usage

Note that this example specifies the latest version. You have to replace it with any specific version to preserve APIs from breaking changes.

<script src="https://cdn.jsdelivr.net/npm/pjax-api@latest"></script>
<script src="/assets/js/config.js"></script>
// config.js
import Pjax from 'pjax-api';
// or
const { Pjax } = window['pjax-api'];

new Pjax({
  areas: [
    // Try the first query.
    '#header, #primary',
    // Retry using the second query if the first query doesn't match.
    '#container',
    // Retry.
    'body'
  ]
});

Browsers

  • Chrome
  • Firefox
  • Safari
  • Edge (Chromium edition only)

pjax-api's People

Contributors

falsandtru avatar newnotmoon avatar sgougi avatar staabm avatar vanillajonathan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pjax-api's Issues

Change <body> class per page?

How do i update the <body> class for each page load?
ページをロードするときにどのように私は、 <body> クラスを更新しますか?

Example:
例:

<body class="page-home">

to:

<body class="page-contact">

when changing between the home and contact pages.
家庭と接点ページ間を変更するとき。

Example on how to setup backend

Hello,

thank you very much for writing this library. I would like to use your library to implement filter and pagination functionality on my site. There will be three elements that get affected after user clicks:

  1. Filter form
  2. Main area with posts
  3. Pagination links

I am having trouble to understand how I need to setup the backend and point pjax-api to the URL. I am using Wordpress so I need to route to admin-ajax.php endpoint which would handle the request. Moreover how can I tell pjax-api on how to populate the above elements with right content?

Thank you in advance.

Uncaught TypeError

version: v3.23.0
chrome: 最新版

再現方法

/page
でページを開いた後、
/page#name
にアクセスする。

結果

Uncaught TypeError: Cannot read property 'title' of null
が出ます。
ちなみに jquery版は問題ありませんでした。

Pjax遷移で遷移先のScriptのみ実行したい

@falsandtru
初めまして。日本語で失礼します。

一通りPjaxサイトのドキュメントは読ませて頂いたのですが、
表題の件を解決できなかったので質問させていただきます。

下記条件で使用した際に

((window, document) => {
//A画面の処理
    $(document).on('DOMContentLoaded pjax:render', () => {
        $.pjax({
            area: ['#contents'],
            load: {
                head: 'base, meta, link',
                css: true,
                script: true,
            },
            link: 'a[data-pjax]',
        });
    });
})(window, document);

A画面からB画面にPjaxにて遷移した際に上記のA画面の処理も実行してしまします。

((window, document) => {
    //A画面の処理
    //loadで実行
    $(document).on('DOMContentLoaded pjax:load', () => {
        $.pjax({
            area: ['#contents'],
            load: {
                head: 'base, meta, link',
                css: true,
                script: true,
            },
            link: 'a[data-pjax]',
        });
    });
})(window, document);

Eventのハンドリングかなと、pjax:loadと試したのですが、
loadにするとpjaxからの遷移時に遷移先のscriptが実行されませんでした。
pjaxの遷移にて遷移先のScriptのみ実行するにはどのような設定をすればいいでしょうか?

お手数をお掛けしますが、ご教授宜しくお願いします。

Support Firefox add-ons execution environment

Hi @falsandtru

I'm the maintainer of a GitHub file tree extension, Gitako, which depends on PJAX lib to work properly. Thank you for implementing this great new generation of PJAX lib, I found it working much better than the one I was using before! However, while it worked very well in Chrome, I encountered an cross-origin issue when trying to use it in Firefox - Not allowed to define cross-origin object as property on [Object] or [Array] XrayWrapper, which crashes my extension then.

image

What I've done

I've tried to fix it by myself, but couldn't figure it out after many hours of work. So I decided to ask for your help.

The reason it happen is, according to MDN, add-on for Firefox runs in a context other than the context that webpage js runs in.

A content script is a part of your extension that runs in the context of a particular web page (as opposed to background scripts which are part of the extension, or scripts which are part of the web site itself, such as those loaded using the <script> element).

BTW, add-on to Firefox is exactly what extension is to Chrome, they are just different names.

So that some operations happened inside pjax-api (e.g. assigning variables to properties of window.location) triggered cross-origin issue because window is not from add-ons context.

But my add-on used https://github.com/MoOx/pjax and it worked well even in Firefox. So I think PJAX mechanism is not technically unavailable in Firefox. What we need is few minor changes in pjax-api, like switching from passing objects to assigning object properties specifically to prevent passing objects cross-origin.

How to reproduce it

If you'd like to help (it would be very kind of you!), please continue reading about how to reproduce the issue on your local environment.

In case you might not be familiar about browser extension development, I've setup a project for you - https://github.com/EnixCoda/pjax-api-firefox-demo

  1. Please clone it and install dependencies with yarn.

  2. Run yarn watch to emit files for debug and then run yarn debug-firefox in another terminal session to debug in Firefox. You should see a Firefox window pop out.

  3. Go visit some webpage. I'd suggest https://nobody.github.io as it'll take you to a clean 404 page which has no much JS files.

  4. Open dev console and you should see App is running! like below, which indicates the app works by default.
    image

  5. Then go to src/content_script.ts, uncomment those commented lines. Now pjax-api is imported. Refresh browser page. The App is running! log won't appear now. Because app crashed in importing pjax-api, before it executed to where the log statement is.

  6. Now go to Debugger tab, check Pause on exceptions and Pause on caught exceptions under breakpoint pane. Refresh page again. You should see exactly what I showed you in the first screenshot - Not allowed to define cross-origin object as property on [Object] or [Array] XrayWrapper.

  7. Then you should be able to see what is going wrong.


I'd be very grateful if you either take a look into the issue or guide me about how to fix it myself. Thank you very much!

GZIP圧縮について

HTML, CSS, JavaScript を GZIP 圧縮した際に正しく動作しません。
なにか設定が必要なら、是非教えて下さい。

js本体

js本体をパッケージに含めて欲しいです。distでもいいです。

ファイルサイズの削減のお願い

はじめまして。このpjaxライブラリは機能が豊富なため、便利に使わせていただいております。

しかしながら、ひとつ非常に大きな問題点があるため、今回、表題の通りのIssueを立てさせていただきました。
このライブラリは、minifyされたものでもファイルサイズが420kb程ありますが、これはあまりに大きすぎるのではないでしょうか。

このライブラリの処理過程についてあまり深くは追えていないため、含まれるすべてが必要なコードであるなら申し訳なく思います。
しかしながら、バンドルサイズの削減、もしくは機能を削減したバージョンの作成などをご検討いただけますと有難く思います。どうかよろしくお願いいたします。

merge laravel pjax error

the second or other request can not get 200 status,and error for request is "Provisional headers are shown"

Import / require Pjax results in empty object

When importing pjax-api, the result is an empty object. This means that trying to initialize throw the "not a constructor" error. Also tried importing using the relative path, same thing. Any help appreciated!

import Pjax from 'pjax-api';
console.log(Pjax); // -> {}
new Pjax({}); // Error Pjax is not a constructor

Interop with Webpack

Enable to bundle with Webpack.

An easy way is exposing APIs to global scope. However, this is dirty. I want to resolve this issue without exposing.

Error when Cache-Control is not set

I get the following error when Cache-Control header is not set:

Uncaught TypeError: Cannot read property 'trim' of null
    at pjax-api.js:3905
    at pjax-api.js:655
    at Either.thunk (pjax-api.js:667)
    at Either.evaluate (pjax-api.js:800)
    at Either.thunk (pjax-api.js:662)
    at Either.evaluate (pjax-api.js:800)
    at Either.thunk (pjax-api.js:662)
    at Either.evaluate (pjax-api.js:800)
    at Either.extract (pjax-api.js:679)
    at Either.extract (pjax-api.js:679)

Example response:

HTTP/1.1 200 OK
ETag: W/"1500-bBhQrFKrKDiHMxhJ8mHxWb5w21U"
Date: Fri, 17 May 2019 21:38:24 GMT
Connection: keep-alive

Express is setting the ETag header but does not automatically set the Cache-Control header. The work around is to set a Cache-Control header.

I believe the issue is that Cache-Control is not being defaulted to '' on this line, but is defaulted to '' just above in the if check.

issue importing spica / localsocket / pjax-api?

I’m trying to use pjax-api by importing it and its dependencies into one js file. However, I’m getting the following error in the console:

_prelude.js:1Uncaught Error: Cannot find module './src/import'
    at s (http://localhost:8000/static/articles/build/js/main.js:1:148)
    at http://localhost:8000/static/articles/build/js/main.js:1:305
    at http://localhost:8000/static/articles/build/js/main.js:14916:55
    at Array.map (native)
    at define (http://localhost:8000/static/articles/build/js/main.js:14903:33)
    at Object.<anonymous> (http://localhost:8000/static/articles/build/js/main.js:18125:1)
    at Object.5._process (http://localhost:8000/static/articles/build/js/main.js:18139:4)
    at s (http://localhost:8000/static/articles/build/js/main.js:1:254)
    at http://localhost:8000/static/articles/build/js/main.js:1:305
    at Object.8.jquery (http://localhost:8000/static/articles/build/js/main.js:66223:14)
    at s (http://localhost:8000/static/articles/build/js/main.js:1:254)
    at e (http://localhost:8000/static/articles/build/js/main.js:1:425)
    at http://localhost:8000/static/articles/build/js/main.js:1:443

The way that I'm importing pjax-api, spica, and localsocket is like this:

import 'spica';
import 'localsocket';
import Pjax from 'pjax-api';

Is this not supported? What is the proper way to import Pjax fully?

More code available in this gist.

File Uploading

ファイルアップロード の件です。
いろいろ解決方法はあると思いますが、ajax.data に FormData を設定したいと思った時になかなか良いタイミング(コールバックなど)で設定出来ずでした。
そこで 汎用性の有りそうな方法として jQuery.ajax(ajax) としている少し前、最後に ajax = $.extend() した後にcallback で
fire ajax.before(event, param, ajax) みたいにトリガーするのはいかがでしょうか?
ローカルではこのタイミングで ajax.data = new FormData(event.currentTarget) としてうまく動いています。
もちろん、ajax.data = form.serializeArray() を置き換えてもいいかもしれませんが、互換性の問題もありますね。

Broke other scripts

Hi,

I organize my code in modules and start other scripts in init.

example

// Common
window.mod.common = function() {

  // Scope
  var that = this;

  var init = function() {
    console.log('[brz] begin common.js');

    window.mod.navbar = new window.mod['navbar']();
    window.mod.mask = new window.mod['mask']();
    window.mod.radio = new window.mod['radio']();
    window.mod.player = new window.mod['player']();

  };

If access via browser or no pjax, the plugins works, but i use pjax, the plugins not instance, example window.mod.player and does not generate errors.

Have you ever had it?

I can not request same url after upgrading from 3.35.3 to 3.38.1

why I need requesting same url? because my login form would make a fake url '/user/login'.

say I am at homepage '/', then click user login btn, url is '/user/login', then I click homepage logo, the url should become '/', but it does not change, remaining 'user/login'

I have not found any config about this.

so what can i do to allow request the same url?

[Question] Config example to ignore url internal and external

Hi, Thanks for this project.

I am sorry to ask but after reading the documentation and testing it and cannot configure Pjax to ignore some URL.

Could you please give an example configuration to ignore

  • '*/xx.php' (internal URL)
  • 'maps.googleapis.com/*' (external url)

To disable ajax I have tried adding to config this:

scope: {
    '*/xx.php': undefined, // disable
    ' maps.googleapis.com/*': undefined, // disable
}

Which are the url I want PJAX disable.

Thanks a lot for your time an effort.

Hello

I am new to Github and I didn't find ways to thank you for creating this plugin and I came here in this issues option to thank you. I suddenly found your plugin in the WordPress repository and I downloaded it and it is definitely the best plugin and I am surprised why people didn't use it much. I was using smoothstate.js but I had a lot of issues with it and it was blocking all javascript. Pjax plugin that you have developed can be one of the best plugins on earth. Really amazing. I have added your plugin on my website and I am highly satisfied with this plugin. Please never stop development of this plugin.
my website is, https://novicecamp.com/

With thanks and regards,
Jewel

REQUEST: html/js/css only example

Hi,

Is there a way you provide an html/js/css only example.

I understand this is not optimal since all the page is requested all the time, but it may help me understand it better and integrated to any server environment.

Thanks

Cannot find module './type'

I thought I’d give Pjax another try. I installed it with npm install pjax-api --save.

I am including it like this:

var Pjax = require('pjax-api').Pjax;

function DOMContentLoaded() {
  new Pjax({
    areas: [
      // try to use the first query.
      'main, .content',
      // fallback.
      'body'
    ]
  });
}

And setting it up through Gulp like this:

gulp.task('site-scripts', function () {
  var b = browserify({
    entries: ['src/scripts/main.js'],
    debug: true
  });

  return b.bundle()
    .pipe(source('main.js'))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: true}))
        // Add transformation tasks to the pipeline here.
        .pipe(uglify())
        .on('error', gutil.log)
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('build/js/'));
});

However, I'm getting this error:

events.js:160
throw er; // Unhandled 'error' event
^

Error: Cannot find module './type' from '/Users/robin/work/2017-01-02_DAVL_website/kirby/assets/node_modules/pjax-api/dist'
at /Users/robin/work/2017-01-02_DAVL_website/kirby/assets/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
at load (/Users/robin/work/2017-01-02_DAVL_website/kirby/assets/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
at onex (/Users/robin/work/2017-01-02_DAVL_website/kirby/assets/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
at /Users/robin/work/2017-01-02_DAVL_website/kirby/assets/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:117:15)

Is there something missing, or could this be a Browserify issue?

can not load javascript

Hi, pjax is not loading javascript files. When enabling load: {script: true} the page refreshes by it self.
I am using jquery-1.11.3.js

Please guide me

End of support for Edge browser

Edge browser can't parse some es6 classes. It has prevented compiling to es6. So I'll end one's support for Edge in the future.

ReferenceError: Use before declaration
           at Anonymous function (.../pjax-api/dist/pjax-api.js:4716:35 <- dist/pjax-api.espowered.js:6766:61)

Google Analytics

What would be the best way to insert google analytics?

I tried in

$ (document) .on ('pjax: ready', function () {
window.ga ( 'send', 'pageview', {page: document.location.pathname, title: document.title});
}

But by analyzing the google analytics sometimes even the pathname are correct and sent the root '/', there is a more appropriate way?

encode url and %

Hi, I have a strange bug on this latest version.
For the internal search engine on my site, I have an uri of the following form: ?page=search&search=hit the fan (via a form sent using the get method)
I'm expecting to see hit%20the%20fan (although normally my search engine works with hit+the+fan). Anyway, I see in the uri: hit%25252520the%25252520fan. As if encode(url) was repeated 4 times? Any ideas? A setting I don't understand?
Thanks a lot.

Ajax POST method become GET

I have a link which deletes a record and I'm using Ajax & POST method. But PJAX "converted" it to GET method. Is there any way to tell PJAX in the API to exclude elements?

This is the simple code.

<a href="...">delete</a><!-- This link trigged by POST method AJAX -->

<div class="card-body">
<div id="pjax-container">
...content
</div>
</div>

new Pjax({
  areas: [
    '.card-body',
    '#pjax-container'
  ]
});

QUESTION: How to update google analytcis

It's not clear to me :( how can I update Google Analytics.

I guessing something like this:

Pjax.load({
if (typeof ga === 'function') {
ga('send', 'pageview', location.pathname);
}
});

However, not sure how to call GA after the new content is loaded via Pjax

Thanks again!!

CSS animations don't transition between page classes

I have a css transitions on the navigations items, and a class called .active triggers them. However, when switching from one page to another, the animation doesn't trigger.

Example:
Home page

<ul>
  <li><a href="/" class="active">Home</a></li>
  <li><a href="/contact">Contact</a></li>
</ul>

Contact page

<ul>
  <li><a href="/">Home</a></li>
  <li><a href="/contact" class="active">Contact</a></li>
</ul>

The animations don't play when changing pages. It looks like the entire DOM element is being injected in to the page, so the state is already active.

Is there a way to apply class changes without reinjecting the entire new page into the DOM?

現在のmaster版は正しく動きますか?

使用法の、
リンクにpjaxを登録します。documentオブジェクトにデリゲートを設定します。
$.pjax({ area: '.container' });
でサンプルコードを動かしましたが、リンクをクリックしてもclass="container"の中身が変更されずに通常遷移されます。demoを落としても同じでした。ブラウザはchromeの最新です。

Cancel ajax request before moving to new page

Hi
I've been using your pjax library and I'm very happy with it. However, I am not able to handle one issue that I'm getting. It is like this:
Page 1: Home
Page 2: Image Listing Page
Page 3: Image detail Page

When a user navigates to Page 2 from page 1, it loads a lots of thumbnail images through lazy-loading (xhr). By lots I mean more than 100. Before all the thumbnail are loaded if the user clicks on any of the image and navigates to Page 3 (image detail page), I've noticed that the browser waits to load all the pending images on page 2 before loading the image in page 3. This has caused a lot of waiting time for image in page 3 to appear (> 5 second)

I could not figure out a way to cancel the pending xhr request while switching page.
Is there any built in feature in the library for this purpose?

Thanks in advanced.

Work with laravel 5.3 and webpack.

Hello, I got an error when using this package in Laravel 5.3 and webpack.

First, I installed the package from npm:

npm install pjax-api spica localsocket

Second, I wrote the script file which should be compiled by webpack.

import Pjax from 'pjax-api';

new Pjax({
    areas: ['body']
});

However, I got an error when compile the file by webpack.

{ [Error: ./~/pjax-api/dist/pjax-api.js
Module not found: Error: Can't resolve './src/import' in '/Volumes/Data/Laravel/test/node_modules/pjax-api/dist'
resolve './src/import' in '/Volumes/Data/Laravel/test/node_modules/pjax-api/dist'
  using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist)
    using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist/src/import)
      as directory
        /Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import doesn't exist
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import.json doesn't exist
[/Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import]
[/Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import]
[/Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import.js]
[/Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import.json]
 @ ./~/pjax-api/dist/pjax-api.js 2084:0-2099:2
 @ ./resources/assets/js/app.js./~/pjax-api/dist/pjax-api.js
Module not found: Error: Can't resolve '../service/state/scroll-restoration' in '/Volumes/Data/Laravel/test/node_modules/pjax-api/dist'
resolve '../service/state/scroll-restoration' in '/Volumes/Data/Laravel/test/node_modules/pjax-api/dist'
  using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist)
    using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./service/state/scroll-restoration)
      as directory
        /Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration doesn't exist
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration.json doesn't exist
[/Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration]
[/Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration]
[/Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration.js]
[/Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration.json]
 @ ./~/pjax-api/dist/pjax-api.js 1890:0-2065:2
 @ ./resources/assets/js/app.js./~/localsocket/dist/localsocket.js
Module not found: Error: Can't resolve './index' in '/Volumes/Data/Laravel/test/node_modules/localsocket/dist'
resolve './index' in '/Volumes/Data/Laravel/test/node_modules/localsocket/dist'
  using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist)
    using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist/index)
      as directory
        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/index doesn't exist
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/index doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/index.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/index.json doesn't exist
[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/index]
[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/index]
[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/index.js]
[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/index.json]
 @ ./~/localsocket/dist/localsocket.js 2359:0-2375:2
 @ ./~/pjax-api/dist/pjax-api.js
 @ ./resources/assets/js/app.js./~/spica/dist/spica.js
Module not found: Error: Can't resolve './src/import' in '/Volumes/Data/Laravel/test/node_modules/spica/dist'
resolve './src/import' in '/Volumes/Data/Laravel/test/node_modules/spica/dist'
  using description file: /Volumes/Data/Laravel/test/node_modules/spica/package.json (relative path: ./dist)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Volumes/Data/Laravel/test/node_modules/spica/package.json (relative path: ./dist)
    using description file: /Volumes/Data/Laravel/test/node_modules/spica/package.json (relative path: ./dist/src/import)
      as directory
        /Volumes/Data/Laravel/test/node_modules/spica/dist/src/import doesn't exist
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/spica/dist/src/import doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/spica/dist/src/import.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/spica/dist/src/import.json doesn't exist
[/Volumes/Data/Laravel/test/node_modules/spica/dist/src/import]
[/Volumes/Data/Laravel/test/node_modules/spica/dist/src/import]
[/Volumes/Data/Laravel/test/node_modules/spica/dist/src/import.js]
[/Volumes/Data/Laravel/test/node_modules/spica/dist/src/import.json]
 @ ./~/spica/dist/spica.js 3233:0-3246:2
 @ ./~/pjax-api/dist/pjax-api.js
 @ ./resources/assets/js/app.js./~/localsocket/dist/localsocket.js
Module not found: Error: Can't resolve './src/import' in '/Volumes/Data/Laravel/test/node_modules/localsocket/dist'
resolve './src/import' in '/Volumes/Data/Laravel/test/node_modules/localsocket/dist'
  using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist)
    using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist/src/import)
      as directory
        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import doesn't exist
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import.json doesn't exist
[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import]
[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import]
[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import.js]
[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import.json]
 @ ./~/localsocket/dist/localsocket.js 2359:0-2375:2
 @ ./~/pjax-api/dist/pjax-api.js
 @ ./resources/assets/js/app.js]
  message: './~/pjax-api/dist/pjax-api.js\nModule not found: Error: Can\'t resolve \'./src/import\' in \'/Volumes/Data/Laravel/test/node_modules/pjax-api/dist\'\nresolve \'./src/import\' in \'/Volumes/Data/Laravel/test/node_modules/pjax-api/dist\'\n  using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist)\n    Field \'browser\' doesn\'t contain a valid alias configuration\n  after using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist)\n    using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist/src/import)\n      as directory\n        /Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import doesn\'t exist\n      no extension\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import doesn\'t exist\n      .js\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import.js doesn\'t exist\n      .json\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import.json doesn\'t exist\n[/Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import]\n[/Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import]\n[/Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import.js]\n[/Volumes/Data/Laravel/test/node_modules/pjax-api/dist/src/import.json]\n @ ./~/pjax-api/dist/pjax-api.js 2084:0-2099:2\n @ ./resources/assets/js/app.js./~/pjax-api/dist/pjax-api.js\nModule not found: Error: Can\'t resolve \'../service/state/scroll-restoration\' in \'/Volumes/Data/Laravel/test/node_modules/pjax-api/dist\'\nresolve \'../service/state/scroll-restoration\' in \'/Volumes/Data/Laravel/test/node_modules/pjax-api/dist\'\n  using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist)\n    Field \'browser\' doesn\'t contain a valid alias configuration\n  after using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./dist)\n    using description file: /Volumes/Data/Laravel/test/node_modules/pjax-api/package.json (relative path: ./service/state/scroll-restoration)\n      as directory\n        /Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration doesn\'t exist\n      no extension\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration doesn\'t exist\n      .js\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration.js doesn\'t exist\n      .json\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration.json doesn\'t exist\n[/Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration]\n[/Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration]\n[/Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration.js]\n[/Volumes/Data/Laravel/test/node_modules/pjax-api/service/state/scroll-restoration.json]\n @ ./~/pjax-api/dist/pjax-api.js 1890:0-2065:2\n @ ./resources/assets/js/app.js./~/localsocket/dist/localsocket.js\nModule not found: Error: Can\'t resolve \'./index\' in \'/Volumes/Data/Laravel/test/node_modules/localsocket/dist\'\nresolve \'./index\' in \'/Volumes/Data/Laravel/test/node_modules/localsocket/dist\'\n  using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist)\n    Field \'browser\' doesn\'t contain a valid alias configuration\n  after using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist)\n    using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist/index)\n      as directory\n        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/index doesn\'t exist\n      no extension\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/index doesn\'t exist\n      .js\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/index.js doesn\'t exist\n      .json\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/index.json doesn\'t exist\n[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/index]\n[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/index]\n[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/index.js]\n[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/index.json]\n @ ./~/localsocket/dist/localsocket.js 2359:0-2375:2\n @ ./~/pjax-api/dist/pjax-api.js\n @ ./resources/assets/js/app.js./~/spica/dist/spica.js\nModule not found: Error: Can\'t resolve \'./src/import\' in \'/Volumes/Data/Laravel/test/node_modules/spica/dist\'\nresolve \'./src/import\' in \'/Volumes/Data/Laravel/test/node_modules/spica/dist\'\n  using description file: /Volumes/Data/Laravel/test/node_modules/spica/package.json (relative path: ./dist)\n    Field \'browser\' doesn\'t contain a valid alias configuration\n  after using description file: /Volumes/Data/Laravel/test/node_modules/spica/package.json (relative path: ./dist)\n    using description file: /Volumes/Data/Laravel/test/node_modules/spica/package.json (relative path: ./dist/src/import)\n      as directory\n        /Volumes/Data/Laravel/test/node_modules/spica/dist/src/import doesn\'t exist\n      no extension\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/spica/dist/src/import doesn\'t exist\n      .js\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/spica/dist/src/import.js doesn\'t exist\n      .json\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/spica/dist/src/import.json doesn\'t exist\n[/Volumes/Data/Laravel/test/node_modules/spica/dist/src/import]\n[/Volumes/Data/Laravel/test/node_modules/spica/dist/src/import]\n[/Volumes/Data/Laravel/test/node_modules/spica/dist/src/import.js]\n[/Volumes/Data/Laravel/test/node_modules/spica/dist/src/import.json]\n @ ./~/spica/dist/spica.js 3233:0-3246:2\n @ ./~/pjax-api/dist/pjax-api.js\n @ ./resources/assets/js/app.js./~/localsocket/dist/localsocket.js\nModule not found: Error: Can\'t resolve \'./src/import\' in \'/Volumes/Data/Laravel/test/node_modules/localsocket/dist\'\nresolve \'./src/import\' in \'/Volumes/Data/Laravel/test/node_modules/localsocket/dist\'\n  using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist)\n    Field \'browser\' doesn\'t contain a valid alias configuration\n  after using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist)\n    using description file: /Volumes/Data/Laravel/test/node_modules/localsocket/package.json (relative path: ./dist/src/import)\n      as directory\n        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import doesn\'t exist\n      no extension\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import doesn\'t exist\n      .js\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import.js doesn\'t exist\n      .json\n        Field \'browser\' doesn\'t contain a valid alias configuration\n        /Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import.json doesn\'t exist\n[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import]\n[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import]\n[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import.js]\n[/Volumes/Data/Laravel/test/node_modules/localsocket/dist/src/import.json]\n @ ./~/localsocket/dist/localsocket.js 2359:0-2375:2\n @ ./~/pjax-api/dist/pjax-api.js\n @ ./resources/assets/js/app.js',
  showStack: false,
  showProperties: true,
  plugin: 'webpack-stream',
  __safety: { toString: [Function: bound ] } }

how to keep css throught pages?

I use same css for all pages in my site, and some css are dynamic loaded by webpack.

When I visit a map page with dynamic css, it works well for the first visit , but wrong for the second visit.

the dynamic css are not loaded again because webpack think the related modules have been loaded.

so is there any way I could keep the css not away ?

Hello,

I have added your pjax plugin from wordpress repository and it is working fine but I have found some issues, php/javascripts are not working from the other plugins and some plugins are also not working properly. I don't know how to fix this.
I want to add Pjax-api that you have added here and I want to add it to Wordpress. How to integrate it?

Thank you once again for making a great plugin. All the best.

Redirect handler

I have form with pjax.
After submit it on url /update, in response i get 302 redirect to location /show.
Content is loaded ok, but url in the address bar is /update.

It's a bug?

Pjax settings

            $.pjax({
                area: ['#pjax-container'],
                form: 'form',
                load: {
                    css: true,
                    script: true
                },
                fix: {reference: false}
            });

Form

<form method="post" action="/update">

question:

When I try using links like:

$.pjax.click('demo.html')

I get an error: TypeError: $.pjax is undefined

Could I be missing a lib? If not, what can be the reason?

Thanks

inline javascript not called

Hi,
I just discovered pjax not execute the inline script when i'm using safari, but other browser works fine.

Safari version 10.1.2 (12603.3.8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.