Giter VIP home page Giter VIP logo

Comments (12)

jenil avatar jenil commented on May 16, 2024

+1 Awesome idea!

What I feel is instead of glyphsearch.com/?f=glyphicons we should have something like glyphsearch.com/#?f=glyphicons so that the page doesn't reload when we change the search query in the URL. What do you think @thomaspark?

from glyphsearch.

jenil avatar jenil commented on May 16, 2024

Hey @thomaspark,

I got up a quick working code on the offline.html file. Check out jenil@1a9b4ca

from glyphsearch.

thomaspark avatar thomaspark commented on May 16, 2024

Hey @jenil27, not a bad start. Some things I noticed, hope you find it helpful:

  • The question mark is missing for searches, but is present as expected when selecting a library.
  • The hash mark is not needed.
  • When going to a direct url, it often requires a hard reload to get the search loaded properly.
  • In Chrome, the query string "blinks". It looks fine in other browsers.

from glyphsearch.

jenil avatar jenil commented on May 16, 2024

Hi @thomaspark,

  • The hash was added so that when I change the URL parameters the page doesn't reload. If I do something like window.location.search = url; then the page will be reloaded.
  • The blink is because the query is processed after page load.
  • The question mark was missing was fixed in jenil@30cca3c, this resolves the hard reload issue.

from glyphsearch.

thomaspark avatar thomaspark commented on May 16, 2024

Definitely should go with one or the other, but not both. I prefer ? since # can then still be used for anchor tags. Check out History.js for changing query strings without a reload.

f and q are cryptic, what if we went with library and search instead?

from glyphsearch.

jenil avatar jenil commented on May 16, 2024

Ya I agree we'll use more relevant works for the parameters. How about we use this http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/

from glyphsearch.

thomaspark avatar thomaspark commented on May 16, 2024

We'll probably want to use replaceState instead of pushState since our search updates with each character.

from glyphsearch.

jenil avatar jenil commented on May 16, 2024

Hey @thomaspark

Check out the latest changes at https://github.com/jenil27/glyphsearch/tree/development

from glyphsearch.

thomaspark avatar thomaspark commented on May 16, 2024

Nice start. Some comments:

  • As mentioned in my last comment, we want to use replaceState rather than pushState. Right now, typing in a query pollutes the browser history since it adds an entry with each keystroke.
  • When loading a page with library and search, only search works. When loading only library or search, neither works.
  • Can we avoid the ? in the URL on load?
  • Instead of constructing the query string with your own changeURL function, consider using jQuery.param().
  • Likewise, instead of having your own inline function to parse query string, consider using an external library like purl in combination with jQuery.param().
  • The loader should be discussed in a separate issue/patch.

from glyphsearch.

jenil avatar jenil commented on May 16, 2024

Yes will shift to replaceState and not use pushState.
I will fix all the above issues and create a PR then. Also I don't think use for a library like purl is needed as parsing it isn't that complex.

from glyphsearch.

thomaspark avatar thomaspark commented on May 16, 2024

Awesome.

purl is available on Bower.

When you're ready to submit a PR, can you rebase and squash to a single commit?

from glyphsearch.

jenil avatar jenil commented on May 16, 2024

I guess this can now be closed 👍

from glyphsearch.

Related Issues (20)

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.