What is the easiest Javascript framework for a newbie web developer? - javascript-framework

Put your foot inside the boots of an expert developer that is new to web development.
Certainly he will must deal with JavaScript and probably he will encounter a bit of difficulties with choosing a framework for its job.
For general purpose: which one do you suggest if the an easy usage is the first requirements?

I've worked with jQuery, script.aculo.us, and mootools, and I would highly recommend jQuery, which seems to trump a lot of the other frameworks in its ease of use.
For someone who is familiar with HTML and CSS, jQuery fits the paradigm really well, and makes the transition into Javascript very simple.
For example, with html such as this:
<div id="content">
<h2>Heading</h2>
<p class="featured">This content</p>
</div>
You might have CSS selectors that looked like this:
#content {
margin: 0 auto;
width: 760px;
}
#content h2 {
font-size: 110%;
}
#content p.featured {
font-weight: bold;
}
In jQuery, you can manipulate those elements using the same selectors:
$('#content').hide();
$('#content h2').html('New Heading');
$('#content p.featured').css('border', '#cccccc 1px solid');
jQuery also has excellent documentation that can really help a beginner jump right in.

I would also put a vote in for jQuery. I have found it to be simple to use, easy to learn, powerful, well documented, feature rich, extensible and backed by a great community of plugin developers.

See here for a comparison by feature.
In the past three years, I've used Prototype/script.aculo.us and jQuery. From the two, I prefer jQuery.

Generally, everyone uses jQuery these days. I like it pretty well.
You might also check out MooTools. Depending on your past experience, you may find it fits your style better.

I'd personally go with jQuery too. That's what I use these days when I need that sort of thing.
Well documented and a plethora of plugins already available.

From a newbie: I have been using jQuery and it creates big results with only a little skill. The more skill you build with jQuery, the cooler and easier things get.
jQuery supports a lot of selectors, It’s easy to add/remove attributes to any HTML element, makes ajax and json easy to use and has a big helpful community.

Related

Add inline css style to JHTML_ (joomla) object

I don't have a lot of experience with Joomla and I'm sure how this will be a really simple question to someone who was work in Joomla before.
I'm working on existing project where I need to add inline css style to elements which are created on this way:
JHTML::_('grid.sort', $name[$id], 'a.'.$name[$id], $this->listDirn, $this->listOrder)
So I need something like this:
JHTML::_('grid.sort', $name[$id], 'a.'.$name[$id], $this->listDirn, $this->listOrder, 'style: height 500px; color: blue;')
Thanks in advance
Every kind of help will be appreciated
There is no way to pass styles to the sort element directly as you can see here in the code
https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/html/grid.php#L74.
What you can do is to add the style on the document directly:
JFactory::getDocument()->addStyleDeclaration('#myelement {height 500px; color: blue;}');
perhaps you want to add !important to the style to enforce it.

Masks not working in Gecko

I am trying to mask an element that has some images inside of it, using only css.
i have done this and it works fine in webkit using -webkit-mask-box-image and its doing just what i want, but im having trouble using other browsers.
gecko is supposed to work using mask, and that tag does show up in firebug, but it doesnt actually use the mask.. i've also tried converting the png im using to base64 data uri, but to no avail.
example: http://jsfiddle.net/nNLta/
does anyone know the correct way for doing this?
HTML
<div id='wrap'>
<div class='masked flashing-anim'>
<div class='the-mask' >
<ul>
<li class='blink_1'></li>
<li class='blink_2'></li>
</ul>
</div>
</div>
<div class='the-outline'>
<img src='img/real-stuff.png' height=500 />
</div>
</div>
CSS
#wrap {
position: relative;
}
.the-outline, the-mask {
position: absolute;
top: 0;
}
.the-mask {
height: 500px;
width: 360px;
-webkit-mask-box-image: url(../img/the-mask.png);
-moz-mask-box-image: url(../img/the-mask.png);
-o-mask-box-image: url(../img/the-mask.png);
mask-box-image: url(../img/the-mask.png);
mask: url(data:lotsofchars);
}
example: http://jsfiddle.net/nNLta/
Part 1
mask is not the same as mask-box-image unfortunately. If you read the (rather sparse) docs you will see it is applicable to SVG only. More on this later.
Currently Gecko doesn't support 'mask-box-image' - if you search the MDN you'll see it applies to -webkit- only.
Additionally I don't think this is actually spec. Webkit has had this capability/concept for ages (in various forms like -webkit-box-reflect) and I think that it's just a hangover from those days. I'm not sure whether this will even be adopted by all browser vendors (although I hope, and it makes sense that, it will).
Part 2
To use the svg dependant mask: css property you need to create an SVG element and reference that. Here is a guide. I've not used this technique before so I'm afraid that's all the detail I'm going to go into right now.
An alternate option
If you don't need a clever repeating/growing mask why not create a large png and overlay the text/image you wish to hide. I'm not sure I understand what you are ultimately trying to do but this seems pretty simple to me. The obvious issue is when you need the stuff behind the mask to be selectable/interactable (err..interactive that is...); for instance when you wish to apply masking to text or links. A way around this is to use pointer-events:none which is supported in Gecko and Webkit (but nothing else...). Here's more from the MDN
Sorry I don't have better news - if none of the above is helpful please feel free to leave a comment with your specific requirement and we'll see if we can't work around the browser limitations.
Hope this is helpful!

JQTransform and reCAPTCHA not playing nice

The Problem:
I am working on a site where I wanted to use JQTransform to quickly get a good looking form for a contact page. Also, to avoid the customer getting junk, I decided to add reCAPTCHA. I ran into the issue of JQTransform styles for the textbox causing the elements in the reCAPTCHA to be displaced.
It seemed like the type of problem that would have a simple fix but I struggled with it for a while.
I tried the solution at:
JQTransform - Exclude an element from styling?
This did not solve the issue, nor did a few other answers to the "How do you make JQTransform stop JQTransforming an element?" question.
What has produced usable results is adding:
<script type="text/javascript">
var RecaptchaOptions = {
theme: 'clean'
};
</script>
This changes the reCAPTCHA to a format that looks better in the form anyway. But it leaves 2 textbox styles. One that is your normal default textbox and another underneath that is the JQTransform rounded corner, light blue on hover/focus textbox.
Then I added:
$(function () {
$( "#recaptcha_response_field" ).attr('style', 'border: 0px; padding: 5px; solid #3c3c3c; width: 302px;');
});
and this alters the style that reCAPTCHA has for the textbox. Now the textbox looks like the other inputs of the form. I am pretty happy with the result.
(I know you're now asking: "Then why are you here?")
The Question:
Is there a way to have JQTransform ignore any input,checkbox,etc that is in the <form></form> by wrapping those in a div?
If I want to use JQTransform with some other plug-in in the future I would like to be able to just drop it in to a div like:
<div class="donot-jqtransform">
<?php
echo printCaptchaPlugin();
?>
</div>
or
<div class="donot-jqtransform">
<%= PrintPasswordValidationPlugin() >
</div>
That way I don't have to worry about what the code brings into the form and it will work and look as intended. That's the idea of having the abstraction in the first place, right? So if I want to switch out reCAPTCHA with another option, all I do is replace code in the printCaptchaPlugin() function and all should be bacon(good) for any form that uses it.
well i've made a new library - csTransPie – basing it on jqtransform – jqtransform is a great library but it really has many problems
I'm creating regular input fields (css styled) and you won't have those problems
https://github.com/pkoretic/csTransPie
It’s a work in progress but even now it’s better than jqtransform (more than half of the css rewritten, many bugs solved, clean css…)
now you can use it per element with just one class!
all suggestions are welcome!
Sorry if it's bad form to pile in on an old answered question, but I found this as I had the same problem.
I didn't want to add another library to my project, so I amended the jqtransform.js to include this line in the TextArea handler (line 221-ish)
if (textarea.parents().hasClass('jqTransformIgnore')) { return; }
I then just had to add the jqtransformIgnore class to the recaptcha div...
<div class="g-recaptcha jqTransformIgnore" data-sitekey="blahblahblah"></div>
... and that did the trick!

How does Cufon affect SEO and Search Bots? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I've been searching the web and can't find an answer to the question
of how using Cufon affects SEO (the way bots from Google, Bing,
Yahoo... read the page). I know the original text is still there, but
it is inside a tag, inside a tag, and is next to
a tag (instead of next to the word that should be next to
it). In other words, do the search bots read "search by", the same
way they'd read the cufon generated html below?
<cufon class="cufon cufon-canvas" alt="search" style="width: 72px;
height: 28.1667px;">
<canvas width="95" height="28" style="width: 95px; height: 28px; top:
0px; left: -5px;"/>
<cufontext>search</cufontext>
</cufon>
<cufon class="cufon cufon-canvas" alt=" by:" style="width: 36px;
height: 28.1667px;">
<canvas width="68" height="28" style="width: 68px; height: 28px; top:
0px; left: -5px;"/>
<cufontext> by:</cufontext>
</cufon>
I really like cufon since I'm not much of a graphics guy, but I also
don't want to ruin any good SEO I've got going.
Thanks in advance for any help or advice,
Chuck Foster
Cufon does not affect SEO at all. Its rendering engine is written in Javascript, and search engines don't read Javascript.
The code snippet you posted is what HTML looks like in your browser after Cufon has done its job; the search engines will only see your original html (the one you view when you click on View > Page Source in Firefox for instance).
A handy tip I learned while reading up on Google SEO is to take a look at your page in a text-viewer to give you a sense of what's visible to Google. You can do that with this handy tool: http://www.yellowpipe.com/yis/tools/lynx/lynx_viewer.php
Notice how your cufon shows up just fine.
Theoretically Cufon shouldn't affect search rankings as it is rendered after the page loads by Javascript. The actual source code still contains the heading. Despite this I found that there were quite a few conflicting opinions about the search-friendliness of Cufon so I've done a small study to try and get some data on whether it does actually affect rankings, here it is: Cufon SEO Effects
The study finds that Cufon doesn't have any direct effect on search rankings, although you could argue that the marginal increase in a page load time on a site that includes the Cufon Javascript file could potentially affect rankings, although in my opinion this difference would be minor.
No SEO impact at all. Much better than sFIR IMO for two reasons. 1. Faster, 2. Simplicity
I have found a great article which will prove there is no "negative seo" in cufon..
http://www.aerodesigns.co.uk/blog/negative-seo-effects-of-cufon/
Thanks..

Finding a blog site with good code block support

This has probably been asked before but I can't find any relevant post using the search system.
I'm looking for a site where I could host my own blog. Unfortunately, I found none that have the kind of code block friendliness found on our very own stackoverflow (not one where you have to manually convert < and > into < and >).
If the answer is "there is none, duh!", and I am condemned to install my own blog software, then which one should I use for a "coder blog" -- knowing that I'd like it to be ultra-simple to set up.
Thanks.
I use a combination of BlogEngine.NET, Windows Live Writer and a WLW extension to format/place the code block in my blog.
Scott Hanselman has a blog post about this topic here.
There is a pretty sweet client-side (jQuery-based) code formatter here that you also might want to check out, that sounds blog-software agnostic.
I use appengine and bloog mostly because of this feature (and because I can extend it anyway I want). The good thing is it's relatively easy to set up and free. If your blog makes enough traffic to go over the limit for free accounts chances are you can get your money back from it.
I was pulling my hair out trying to format code on Blogger until I found this handy utility. It's not a perfect solution, but it goes a long way.
This css script might be useful to all - It is not for syntax highlighting but works well for presenting the source code in original format :
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace;
color: #000000; background-color: #eee;
font-size: 12px; border: 1px dashed #999999;
line-height: 14px; padding: 5px;
overflow: auto; width: 100%">
<code style="color:#000000;word-wrap:normal;">
<<<<<<<YOUR CODE HERE>>>>>>>
</code>
</pre>
How to use :
Paste this snippet in text editor,
paste your code in <<<<<<>>>>>> block.
Copy all and
paste to HTML view in blogger(or any other) post editor.
BENEFITS : Simple and easy to use, less configuration, easy to reconfigure, no extra software

Resources