Search Amazon.com:
Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us $3,400 per month for bandwidth bills alone, and since we don't believe in shoving popup ads to our registered users, we try to make the money back through forum registrations.
  • Post
  • Reply
duck monster
Dec 15, 2004

Never stop arguing about casual racism.


triplekungfu posted:

What's the deal with the MIT license, is complying with it really as simple as just including the license?

MIT is pretty much a "do whatever the gently caress you want" type license.

jquery is amazing, and the heavy use of lispy closures really helps clarify readability and helps encourage functional programming styles. The fact that you can *mostly* push all the javascript, including hooking triggers, outside the HTML gives me a hardon. This is great stuff.

And yes, the plugin quality is very hit and miss. But its javascript, whatya expect.

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


Dromio posted:

Is there some way to insert conditionals into one of these jquery chains? I'm using the jquery html canvas plugin to draw a curved box around an element like this:
CODE:
$("#myCanvasElement").polygon(
         [0, 0],
         [
         ['moveTo', [ntr, nt]],
         ['quadraticCurveTo', [nr, nt], [nr, ntt]],
         ['lineTo', [nr, ntb]],
         ['quadraticCurveTo', [nr,nb], [ntr, nb]],
         ['lineTo', [ntl, nb]],
         ['quadraticCurveTo', [nl, nb], [nl, ntb]],
         ['lineTo', [nl, ntt]],
         ['quadraticCurveTo', [nl, nt], [ntl, nt]],
         ['lineTo', [ntr, nt]]
         ],
         { 'fill': true, 'stroke': true, 'close': true },
         {
             'fillStyle': 'rgba( 150, 195, 150, .9)',
             'strokeStyle': 'rgba( 0, 0, 0, 1)',
             'lineWidth': 1
         }
         );
I want it to be a "speech bubble" with one corner pointing to a point on screen, but the corner chosen depends on the relation of this element's position to that point. Is there some way for me to toss a conditional into the middle of this chain?

Edit: Oh crap, forgot that I'd switched to this "polygon" function that isn't even a chain. Ugh.

Why dont you prepare some variables with the location of the tail thingo, and *then* use your canvas to do it.

Or just not nest it.

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


Woah look what I found....

http://plugins.jquery.com/project/jqcouch

CouchDB bindings for jQuery.

I genuinely think schemaless databases like couch are the future, but looking at that, holy poo poo would couch make a loving amazing local end store for offline JS apps.

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


Theres another jquery plugin called 'notemplate' that basically takes a data dictionary (nested if need be) and uses it as a templating system.

You combine that with couch, and you have a cms in a few lines of javascript. An *absurd* and *insecure* cms, granted. But a CMS none the less.

Wild stuff.

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


fansipans posted:

http://blog.napkindrawing.com/fansi.../nestFuncs.html



That was good practice. Heh, kinda forgot this was the jQuery thread though, I intentionally took out my little $ and map helpers. It's neat what you can do when functions are objects.

javascript can be disturbingly functional sometimes.

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


Ghotli posted:

You mention firebug then you tell him to use alerts. Firebug's console.log() is much cleaner in firefox for debugging. Alternatively there's a cool little logger called blackbird for debugging javascript in just about any browser.


I'm not sure how you can code with such a huge tabstop. The readability of your code will improve greatly if you change it. I'm a tabstop=2 man these days.

Theres something magical with firebug you can do that *really* makes firebug a fantastic first line debugging environment.

FirePHP is a php library that adds the command fb() that allows you to send poo poo to the firebug console from php. The magic however, is that the console message appears nowhere in the HTML, but instead is passed via a http header line.

What that means is that you can use something like fb(array(1,2,3),'array') in the code that processes an ajax request, and it will send that array to the firebug CONSOLE without messing up the ajax request. And that, in my opinion is *huge*. In fact it even works when sending stuff back with wierd mime types like jpegs or whatever, because its an out-of-band message.

Now with all that, even with firebug and jenkman, debugging javascript still sucks.

edit: One more thing;- theres also a mini version of firebug for internet explorer, but in the form of a javascript library you <script blah=".. include in the page itself. Its not as good as the real thing, but its passable and it makes life a LOT easy than the hell that is Internet Explorer.

Normally javascript work tends to be "Debug on mozilla then smash yourhead on the desk for hours trying to debug ie7s idiocy", but this makes it ALOT easier.

duck monster fucked around with this message at Mar 4, 2009 around 05:07

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


I'm sure I'm doing something obviously wrong here, but damned if I cant get it to work.

Heres some html:

code:
<div>
		 	<div id = "imagepane" class="imagepane" style="display:none">
		 	<h1>IMAGE PANE!</h1><br/>
		 	<a href="#" class="ti" id="p1"><img src="/static/images/standin200x100.png" class="thumbimage" id="ip1"/></a>
		 	<img src="/static/images/standin200x100.png" class="thumbimage" id="p2"/>
		 	<img src="/static/images/standin200x100.png" class="thumbimage" id="p3"/>
		 	<img src="/static/images/standin200x100.png" class="thumbimage" id="p4"/>
		 	<img src="/static/images/standin200x100.png" class="thumbimage" id="p5"/>
		 	<img src="/static/images/standin200x100.png" class="thumbimage" id="p6"/>
		 	<input type="file" id="uploadfield"/><button id="uploader">Button</button>
	 	</div>
			<div id = "mappane" class="imagepane" style="display:inline" >
					{{ map }}
			</div>

			
			<div style="float:right; width:300px;">
						<a onClick="imgmanager();" href="#"><img src="/static/images/standin300x110.png" class="sideimage"g></a>
						<img src="/static/images/standin300x110.png" class="sideimage"/>
						<img src="/static/images/standin300x110.png" class="sideimage"/>
</div>
Excuse my bonkers indenting.

Heres some jquery to go with it..
code:
function imgmanager () {
	$('#mappane').hide();
	$('#imagepane').show();
	$("#thumbimage").click(function(){
		alert ("Calling"+$(this).attr('id'));});
}

So when that first sideimage is clicked, it triggers imgmanager() , which in turn hides #mappane, shows #imagepane and then is SUPPOSED to attach a click function to all the #thumbimage images , for now just popping up an alert.

The problem is, for the life of me I cant attach anything to #thumbimage. Heck I can't even .hide() them.

Is the fact they where hidden before molesting jquery's ability to do poo poo with them?

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


smug forum rear end in a top hat posted:

your thumbimages are classes, but your jquery selector has them as ids. $("#thumbimage") should be $(".thumbimage")

Ah.....fffff of course. Doh.


e: Off topic, but I figured I'd leave it here. Heres a webpage I just found. Its a page showing off Internet explorer CSS filters, from back in the day. For full effect, view in firefox or , actually, anything that isnt a crusty old version of internet explorer [no idea if they still work in new versions]. http://www.fred.net/dhark/demos/css...r_examples.html Once upon a time people thought this was a good idea.

duck monster fucked around with this message at Mar 9, 2011 around 07:58

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


Ok, one more for the road.. Whats the usual way folks go about doing ajax image uploads. The major caveat here is that flash is a no-no for me.

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


excidium posted:

Check out http://plupload.com/ for your uploader. It's got a bunch of fallback options and degrades nicely.

Bitching. All the stuff I found on the net seems to use flash, which is out of the question due to the ipad rollout the client is doing.

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


Munkeymon posted:

You can upload files from an ipad in the browser? I thought iOS pretended there was no such thing as a file or filesystem

Erm. Had not thought of that! Still consistency and all that, the client don't want flash, the client don't get flash.

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

Never stop arguing about casual racism.


fletcher posted:

POST the data to an iframe on the page

code:
<form target="upload_iframe">
    <input type="file"/>
</form>

<iframe name="upload_iframe"/>

Yep, that'd work too. Its a hack, but so is everything else I've seen.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply