Coder Social home page Coder Social logo

blast's People

Contributors

julianshapiro avatar kennethormandy 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blast's Issues

Blast treats spaces between words as non-characters.

Blast treats spaces between words as non-characters. This causes the character delimiter to return improper indexes. Because of this, lining up character index data with blast's generated blast-indexes is very difficult.

There should be an option to treat whitespace as characters in order to maintain the actual index of characters from start to finish in a string of text.

By the way... this could be handled simply (I think) by adding a "preserveWhitespace" option that would only apply to characters. Then, you could do this inside the delimiter creation section:

case "character":
                /* Matches every non-space character. */
                /* Note: This is the slowest delimiter. However, its slowness is only noticeable when it's used on larger bodies of text (of over 500 characters) on <=IE8.
                   (Run Blast with opts.debug=true to monitor execution times.) */
                if (opts.preserveWhitespace)
                    delimiterRegex = /(.)/;
                else
                    delimiterRegex = /\S/;
                break;

I don't know if "." is the best way to do this. Perhaps it should only preserve the actual space character.

As a sidenote, to render properly you would need to give white-space: pre|pre-line|pre-wrap to the blasted element to make the spaces not collapse in their own HTML elements.

@julianshapiro , did you consider any of this during initial development?

add the first space into sentences

Hi,
I don't think it's an issue, more a request: Blast is awesome, I have so many ideas I could use it for my projects. The only thing I found annoying, and I'm not good enough with js to figure how to change it, is that if I want to style sentences, Blast leaves the space right after the end of every sentence outside of span tags, leaving an unstyled space between every sentence. Is that clear ? Is there an easy fix for this ?
For now, i do this in js :

$("document").ready(function() {
    $("p").blast({
        delimiter: "sentence"
    });
    $('.blast').prepend('&nbsp;');
});

and hide the last space with font-size:0 in css. But then there is an extra space before the first sentence of every paragraph. Anyway, far from perfect.

Again, this is really great otherwise, so many thanks !
best,
Robin

DOM.normalize() not working properly in IE

On Line 419, thisParentNode.normalize(); is called in order to combine and clean up all child nodes. On certain versions/certain settings in IE, the normalize(); function does not work correctly. It does not combine the child nodes, which in turn leads to faulty results.

For example:

  1. Searching for "pm" in [email protected]
  2. The child nodes could be "cs.p", "[email protected]".
  3. blast.js will search for "pm" in "cs.p"
  4. blast.js will search for "pm" in ""[email protected]"

Both will return no matches. The correct functionality should be:

  1. Searching for "pm" in "[email protected]"
  2. The child nodes should just be "[email protected]".
  3. blast.js will search for "pm" in "[email protected]"
    A match is found.

I know this is mostly a bug in IE, but maybe changing the code to not use this function, and instead doing it manually might be the better choice. Another solution might be to combine all child nodes into one, before searching through them. Although this is not necessary a bug with blast, it does affect it.

Here is more information: http://stackoverflow.com/questions/12972090/ie-9-standards-mode-normalize-method-does-not-work

interactive blast while user inputting text

Within a contenteditable div, I will execute a blast as the user is typing to highlight the last group of nouns entered into the div by the user (using an NLP package). After the blast, the cursor is positioned at the beginning of the blast style DOM object, as opposed to the end of it. When the user continues typing, the blast is removed and the cursor actually is positioned where expected -- however, while the blast is shown, the cursor blinks at the beginning of the blast span and would lead the user to think that any typing that is about to be done will occur before the blast span of text.

Blink after fadeIn iOS 5

After effect in iOS 5 blink the last word.

$("#lastnews .ticker_tick")
    .html(data.title)
    .attr("href", data.hash)
    .blast({ delimiter: "character", aria: false })
    .velocity("fadeIn", {
        display: null,
        duration: 600,
        stagger: 60,
        delay: 600,
        mobileHA: !conditionizr.ios,
        complete: $$.last_news_home.after_magic
    });

Blasting every N words

I have to make speed reader .... a set of three words gets highlighted ... how can i achieve this quickly ?

Bug when searching with "sentence"

Steps to Reproduce:

  1. enter the word "sentence" into the textbox #txtBtnSearch in the Robustness Gallery section.
  2. Press "search" button (#btnSearch)

Expected:

  • Occurrences of the word "sentence" are highlighted

Actual:

  • Occurrences of the word "sentence" are highlighted
  • Additional text (looks like an encoding) is injected
    • 'e{{46}}g{{46}} Blast{{46}}js'
    • Pressing any other button in the section undoes the injected text.

image

Can I use Blast without modifying the Dom?

I've been looking all over for a library to split articles into paragraphs, sentences and words. As you know its not as easy as splitting at every '.'

Is there any way to use Blast to return an array of sentences without referencing the Dom elements?

OR

Is Blast based on some library logic somewhere?

Please and thank you for the assistance.

Emoji aren't rendered in Chrome or Safari

I am having an issue where emoji aren't showing up after the character blast apart. Works in Firefox just fine, but no other browser. Is this related to the utf-8 character separation thing?

Blast both words and sentences at same time?

Hi Julian,

Gotta start with saying this is awesome work. Haven't seen anything that comes close to transforming a webpage of text into a DOM structure that can be manipulated at the word/sentence level. So thank you!

I can peer into source at some point, but off the top of your head, is it possible to use Blast, either as is or modified, such that I can manipulate text at the word level and at the sentence level at the same time? Not sure if that makes sense but let me try to explain in code:

<div>
    Hello World. How are you?
<div>

into:

<div class="blast-root">
  <div class="sentence-1">
    <span class="blast">Hello</span>
    <span class="blast">World.</span>
  </div>
  <div class="blast-sentence-2">
    <span class="blast">How</span>
    <span class="blast">are</span>
    <span class="blast">you?</span>
  </div>
</div>

Thanks also for still replying to issues and continuing to support this work!

RexExp Delimiter with Ignore Case Flag and Multiple Matches of Differing Case Causes Offset in First Instance

for working example, see http://codepen.io/anon/pen/pyYJzv

If you have

<div>
  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do. Eiusmod tempor incididunt ut labore et dolore magna aliqu.
  Lorem IPSUM dolor sit amet, consectetur adipisicing elit, sed do. Eiusmod tempor incididunt ut labore et dolore magna aliqu.
</div>

and search for ipsum

$("div").blast({ delimiter: /ipsum/gi, debug:true });

notice the case of ipsum in both sentences. The result is

<div aria-label="..." class="blast-root">
  Lorem<span class="blast" aria-hidden="true" style="background-color: rgb(7, 93, 154);"> ipsu</span>m dolor sit amet, consectetur adipisicing elit, sed do. Eiusmod tempor incididunt ut labore et dolore magna aliqu.
  Lorem <span class="blast" aria-hidden="true" style="background-color: rgb(241, 33, 133);">IPSUM</span> dolor sit amet, consectetur adipisicing elit, sed do. Eiusmod tempor incididunt ut labore et dolore magna aliqu.
</div>

notice that the first instance is offset by 1

<span ...> ipsu</span>m

My workaround is to lower-case the comparison of matchText and subMatchText, although I don't think this is the correct solution as simple lowercase comparisons are not necessarily appropriate in all locales:

https://github.com/saviourofdp/blast/commit/1a171d62c3af3fa2e980cebe76e1cd9a39e7dbc8

Abbreviated first names

When a first name is abbreviated, the library doesn't normally catch it. A good solution might be to add the following regex as an exception for this case:

[A-Z][a-z]*\.\ [A-Z]

In action: Regex101.com

It accounts for all the instances of F. Presencia or similar first names abbreviations.

Here a list of examples of first names, all follow this pattern.

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.