Text search in an AIR HTML Control - search

What are the different options available for implementing a text search in an AIR HTML control? I could think of the following two:
Implement by injecting a custom javascript - the downside is the script may interfere with ones already loaded with page
Implement an HTML scraper and then parse this text in Actionscript, and then using javascript highlight it.
Thoughts are most welcome.

The best way to perform text search in an HTML control via actionscript is to look for text nodes, extract them, perform a match, and then break the text node into 3 separate nodes:
1. The text node with part before
2. A new highlighted node with search term
3. The text node with the part after.

here's a start: Using HTML in Flex-based Adobe AIR Applications. there's a section on calling javascript.

Related

Downloading part of an EJS page as a PDF file

I have little developing experience and I would really appreciate it if someone could point me in the right direction with my little project.
Basically, I have this first page where the user fills a form via radio buttons. These choices all represent pieces of texts in the database. When the form is submitted, an EJS page is rendered where these texts are merged. I've managed to make it work this far using Node, Express and MongoDB.
As the next step I'm trying to give the user the option to download the generated text as a nice looking PDF file. What would you recommend me to use?
You can use tools like node-html-pdf which takes a picture from your generated html page from EJS and print it using an headless browser.
Note : Since PhamtomJS is deprectated, node-html-pdf's too.

Text is writing code

I want to add on my site a text who is writing, as in http://www.whoismrrobot.com/
I use the code <Marquee>Text Here</Marquee> but this code only rolls the text.
The effect on your example site is not achieved with the marquee tag, and it can't be done this way. I guess the site is using some combination of JavaScript, CSS and maybe server side scripting.
Generally using the marquee tag is a bad idea, as it is some remnant of the "old times", when format and content both were provided by the html page itself. Even back then the marquee tag wasn't part of the html-specification and not supported by every browser.
For further details see this description of the tag.

Inserting a news-feed widget to a page

I have a page I'd like to embed a news-feed widget into (so that the feed from some remote site will be displayed in my site).
While there are quite a few free news-feed widgets available out there (a partial list is here: http://allwebco-templates.com/support/S_script_newsfeed.htm), They all require insertion of complex code into the html page, while all the parameters are hard-coded into the generated code, which looks something like this:
insertedWidgetText = "<script id=\"scrnewsblock10795953\" type=\"text/javascript\">...script specific parameters go here...</script>"
let feedWidget = toWidgetBody [hamlet|#{preEscapedText insertedWidgetText}|]
This doesn't integrate well with Yesod's approach as it requires specifying to Hamlet that the content is preEscapedText, which in turn disables the ability to use Hamlet's processing to alter parameters of the widget dynamically (So in case I want the widget to use a different source, for example, I need to statically change the quoted text and cannot use Hamlet's variable substitution).
Of course I could do some text manipulation myself, tailor built for the widget I'm using, but that doesn't seem like the "right" solution (especially if I want to have the embedded text in some external file and not in the middle of my code as in the example above).
Can the above mentioned issue have a better solution than the one I thought about?
Is there an implementation of a news-feed widget in Haskell/Yesod that I can use as a plugin?
Note: I'm a very poor javascript programmer, but solutions in that direction are also welcomed.
Thanks,

How to handle formatting like bold, italic, images, etc with resource bundle internationalization

I am using JSF 2.0 framework to build a web application.
I know how to handle java web application internalization (i18n) using ResourceBundle.
This approach is suitable when you have to work on single words or phrase.
But when you have an entire paragraph or a whole text whith formatting (blod, italic, images, etc), how can we handle i18n in this case? Because of formatting, I don't know if it will be a good idea to put that text in a properties file.
There is not really a standard for this. It's in general affordable as long as you don't put markup which represent layout in the resource bundle files. Elements representing layout are usually HTML block elements like <div>, <p>, <h1>, etc. So, you need to make sure that you restrict to using HTML inline elements like <b>, <i>, <img>, <span>, <br>, etc in properties files.

Stackoverflows WMD System - Where does my input become HTML?

At what stage does my input in the textarea change from being this raw text, and become HTML?
For example, say I indent 4 spaces
like this
Then the WMD Showdown.js will render it properly below this textarea I type in. But the text area still literally contains
like this
So is PHP server side responsible for translating all the same things the showdown.js does to permanently be HTML in the SoF Database?
There are some other posts here about this, but basically it works like this. Or at least this is how I do it on my website using WMD; see my profile if you're interested in checking out my WMD implementation.
User enters the Markdown on the client, and showdown.js runs in real time in the browser (pure client-side JavaScript; no AJAX or anything like that) to give the user the preview.
Then when the user posts to the server, WMD sends the Markdown (you have to configure WMD to do this though; by default WMD sends HTML).
Run showdown.js server-side to convert the Markdown to HTML. In theory you could use some other method but it makes sense to try to get the same transformation on the server that the user sees on the client, other than any HTML tag filtering you want to do server-side.
As just noted, you'll need to do appropriate HTML tag filtering to avoid cross-site scripting (XSS) issues. This is both important and nontrivial, so be careful.
Save both the Markdown and the HTML in the database—the Markdown because if users want to edit their posts, you want to give them the Markdown, and the HTML so you don't have to transform Markdown to HTML every time you display answers.
Here are some related posts.
Convert HTML back to Markdown for editing in wmd: Tells how to configure WMD to send Markdown to the server instead of HTML.
What HTML tags are allowed on Stack Overflow?: Useful for thinking about HTML tag filtering.
Well first of all StackOverflow is built on ASP.NET, but yes essentially the characters in the rich text box gets translated back and forth.

Resources