Code Monkey home page Code Monkey logo

js-doofinder's People

Contributors

abellosovic avatar agutierrezrodriguez avatar bogus-bill avatar carlosescri avatar dependabot[bot] avatar ecoslado avatar jesusenlanet avatar joez99 avatar manu1080 avatar mingoarte avatar peillis avatar resetreboot avatar sariogonfer avatar serguitus avatar sonic182 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

Forkers

aise17 lukasdrgon

js-doofinder's Issues

Facet fields with ' produce an error

Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Element': '[data-facet='type d'utilisation'][data-value]' is not a valid selector.
    at n (https://cdn.doofinder.com/media/js/doofinder-classic.6.latest.min.js:1:7453)
    at Object.r [as ft] (https://cdn.doofinder.com/media/js/doofinder-classic.6.latest.min.js:1:8522)
    at o (https://cdn.doofinder.com/media/js/doofinder-classic.6.latest.min.js:1:5620)
    at HTMLDivElement.a (https://cdn.doofinder.com/media/js/doofinder-classic.6.latest.min.js:1:5783)
    at HTMLDivElement.E (https://cdn.doofinder.com/media/js/doofinder-classic.6.latest.min.js:1:7755)

This works:

document.querySelectorAll('[data-facet="type d\'utilisation"][data-value]');

But this doesn't

document.querySelectorAll("[data-facet='type d\'utilisation'][data-value]");

[Widget][QueryInput] - Clean should empty the value of the input

  • Add a cleanValue option to the widget (true by default).
  • Add a clean method that cleans the value when called only if cleanValue is true.

Cleaning the value is the natural behavior (not yet implemented) but sometimes you may need to change that behavior so the input is not cleaned.

@abellosovic, @ecoslado asked me to assign this issue to you to be done right now 😃 . Good luck!

QueryInput refactoring

  • Accept multiple query inputs.
  • Only one can be the currentInput, so layers that position themselves can do based on the current input location.
  • Think about how to attach to the actual nodes so no more than one QueryInput can be attached to the same input, forcing other controllers to be registered to a single QueryInput. This can have many caveats, think carefully and play with multiple controllers associated to different query inputs.

This would make easier to setup selectors in layers.

Stop using CoffeeScript, use ES6 instead

If you use CoffeeScript, you end using its sugar, like:

for own key, value of something

By using that construct in different modules, you end having this repeated 9 times in the current compiled code:

hasProp = {}.hasOwnProperty;

You can infer what happens with other constructs.

I'd like to compare transpiled ES6 with compiled CoffeeScript in some modules to see what happens.

queryInput

Hello,
Can I use queryInput with class for multi element instead of Id?

"queryInput": ".search"

Thanks.

[RangeFacet] - Remove filter when values are the same as the original values of the range before any filtering

https://github.com/doofinder/js-doofinder/blob/master/src/widgets/facets/rangefacet.coffee#L96-L99

Use case:

  1. Type a query
  2. Facets are rendered
  3. Use the slider, filters are added to the controller.
  4. Revert handlers to the original position, values should be the same as when the widget was initially rendered.

But the filters remain in the controller when you're actually not filtering by price because those are the original values.

Why this issue? You can use this in the template to know if any filter is applied:

{{#filter}}FILTERED{{/filter}}

But with the current behavior that's not true after using and resetting the range slider.

'df:next_page' is triggered after checking for conditions, but 'df:get_page' not.

for triggering "df:next_page" :

  nextPage: (replace = false) ->
    if @status.firstQueryTriggered and @status.currentPage > 0 and not @status.lastPageReached
      @trigger "df:next_page"   
      @status.currentPage++
      @__search(true)

that is, after it checks that in can actually do the search, it triggers the event

for "df:get_page" :

  getPage: (page) ->
    @trigger "df:get_page"
    if @status.firstQueryTriggered and @status.currentPage > 0
      @status.currentPage = page
      self = this
      @__search()

before doing the pertinent checks, the event is triggered.

which way do you prefer? Personally, I prefer to trigger the event after the checkings, but whichever is it, it should be the same for both.

Update to noUiSlider 11

Try to fix:

  • Tooltips disappear when they reach the opposite side of the slider.
  • Use as few CSS as possible.
  • Pips are rendered in the RangeFacet widget due to a weird behavior in the current version of noUiSlider so try to get rid of that if possible and use native pips in noUiSlider 11.

Regarding the tooltips disappearing, it happens when using the slider inside a container with scroll:

overflow-x: hidden;
overflow-y: auto;

Refactoring

  • Refactor QueryInputWidget to trigger special key events (like ENTER).

use coffeescript splat operator

as far as I know, coffeescript allows the use of things like my_function: (param1, args...)
In client.coffee variable arguments in functions are treated very crappy.
Maybe there are other places to make use of this, I didn't check it all.

the queryInput widget skips inputs with empty type attribute

@carlosescri
this is code from the queryInput widget

  setElement: (element) ->
    @element = ($ element).filter [
      'input:not([type])',
      'input[type="text"]',
      'input[type="search"]',
      'textarea'
    ].join ","

https://idoctor.es/# has a searchbox like

<input type="" name="" value="Ej: Consulta Traumatología Madrid" size="35px" style="size: 500px; float: left; height: 50px; border-radius: 5px; font-size: 18px;" onclick="if(this.value=='Ej: Consulta Traumatología Madrid') this.value=''" onblur="if(this.value=='') this.value=''">

with has an empty value as its type attribute.

Classic layer doesn't work because queryinput filters out that kind of input.

Do we want this? if so, Is it on the doc??

Refactor dfdom

  • This doesn't work: @resultsWidget.element.find('[data-role="placeholder"]').remove(). Refactor dfdom!!! (Related: #64, 65)
  • Add hasAttr to dfdom.

Doofinder Layer v5: Look what to do with mobile version

Maybe the solution would be:

  • Those users who have mobile addon and want to use the current mobile version, just fill in the mobile version option.
  • Those users who have mobile addon and want to use normal layer, do nothing.
  • Those users who don't have mobile addon, they won't be able to watch layer nor current mobile version.

This would be a good option, but Android keyboard hides almost the whole layer, so we must decide what to do. Some customers ask for using the layer, because of the customizable and because you don't have to navigate to other page.

This customer have written asking for this:
[email protected]

looks like the addParam method of the controller is useless

according to the doc
https://github.com/doofinder/js-doofinder/#addparam
"Adds new search parameter to the current status."

by looking at the code, addParam adds keys to the internal @status.params dictionary

But every time controller.search() is called, @status.params dict is reseted
https://github.com/doofinder/js-doofinder/blob/master/src/controller.coffee#L104

so any prior modification made to @status.params is overriden.

looks like the method is superfluous, unless it's intended for other thing

@ecoslado, please wight in.

CloseOnClick is mixing up the history

https://doofinder.freshdesk.com/helpdesk/tickets/6706

Hi,

if I use „closeOnClick“: true doofinder is mixing up the browser history:

  1. User navigates to site
  2. user is browsing (is important)
  3. opens product (wich has reviews)
  4. User clicks on „Bewertungen“ => below the stars upper right corner (internal named-link with #)
  5. Site refreshes(!) not navigates <= bug
  6. If user then clicks back (in the browser)
  7. User is on main page!!!!!

It is not live in my system but you can simply reproduce.

www.marienfiguren.de

write methods .one to subscribe function to an event just once

  • Write a method .one for util.dfdom (bean based)
  • Write a method .one for Widget (that invokes dfdom.one)
  • Write a method .one for Controller (that invokes dfdom.one)

I'm also thinking about creating a mixin which manage the events thing. Widget and Controller would inherit from it the bind, unbind, one and trigger methods. I don't know how to implement multiple inheritance in coffee and it's just a suggestion

@JoeZ99 this is for layers test, maybe you could implement the easy part and we could debate after about the mixin.

Refactor client

  • We may not need Client.__escapeChars() and use window.encodeURIComponent() instead but the way methods are called must change to avoid double escaping.
  • Try to have only one method to send stats instead of N in the Client and N in the Session. Better N in the Session (if necessary) and 1 in the Client (if possible).
  • Remove support for Doofinder Search API v4 from Client

Consider using lit-html for templates

https://polymer.github.io/lit-html/

Google says it's faster than virtual dom and it actually uses ES6 tagged literal templates. But IE (and probably other old browsers) doesn't support them, so we have to analyze if we want to use it.

The thing is: increase performance but allow users to use something that looks like HTML (currently that's Mustache). Virtual DOM uses plain JS to express HTML and end users won't know what to do with that (thinking on stuff derived from the use of this library). lit-html allows to directly interpolate JS.

Well, evaluate.

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.