Learn Dash Ajax Dot Com

Confessions of a web developer

JS1K Contest - The JavaScript 1 KB Contest

clock August 10, 2010 19:41 by author nickyt

Do you have what it takes to make an awesome 1 kilobyte JavaScript demo? Check out http://js1k.com .

Thanks to sitepoint.com for sending this out in their newsletter. Out of the random demos I saw, this one was pretty cool, http://js1k.com/demo/182 and this was a good time waster too, http://js1k.com/demo/176 .



HTML5

clock August 3, 2010 14:53 by author nickyt

Welcome to the Canadian Developer's HTML 5 Showcase Page

This page is dedicated to showcasing Canadian developers and what they've done with HTML5. So far nothing here, but if you have some cool stuff that you've done in HTML5 and you're Canadian, send us a link with a description of what you did and we'll post it here.

At some point if this list starts to get big, I may start a site of it's own dedicated to just this. Let's see what happens.

Don't know what HTML 5 is? You should. Check out:


Don't think that HTML 5 can do cool stuff, check this stuff out:
See how your browser fares. Take the HTML5 test.

Cheers,
Nick



Awesome Short Film: Logorama

clock April 23, 2010 01:53 by author nickyt

Thanks to my friend Kim for sending me this. Awesome film.

Logorama from Marc Altshuler - Human Music on Vimeo.

That Michelin man sure is badass.



Fix for Infragistics Web Grid Row Multi-Select on a Mac

clock April 21, 2010 19:00 by author nickyt

Well a while ago I posted a thread on the Infragistics forums and didn't even get a peep from any Infragistics people. So I took it upon myself to fix the issue. I tracked down the suspect client-side code and modified it so that the Apple key could be used for multi-selecting rows in an UltraWebGrid.

I use jQuery's $(document).ready to apply the fix, but use your own favorite client-side framework to apply the fix. I didn't bother trying to recompile the Infragistics assemblies with the updated client-side embedded resource. This just seemed easier.

Here's the fix.

window["igtbl_cellClickDown"] = function(evnt, gn)
    {
	    var gs = igtbl_getGridById(gn);
	    if (!gs || gs.isDisabled())
		    return;
	    gs.event = evnt;
	    igtbl_lastActiveGrid = gn;
	    gs._mouseDown = 1;
	    gs.Element.setAttribute("mouseDown", "1");
	    var se = igtbl_srcElement(evnt);

	    if (!se || se.tagName == "IMG" && se.getAttribute("imgType") == "expand")
		    return;

	    if ('' + se.contentEditable == 'true')
		    return;

	    igtbl_filterMouseUpDocument();
	    if (!se || se == gs._editorCurrent) return;

	    if ((se.id == gn + "_vl") || (se.parentNode && se.parentNode.id == gn + "_vl")) { if (gs._focusElem) ig_cancelEvent(evnt); return; }
	    if (se.id == gn + "_tb" || se.id == gn + "_ta")
		    return;
	    var sel = igtbl_getElementById(gn + "_vl");
	    if (sel && sel.style.display == "" && sel.getAttribute("noOnBlur"))
		    return igtbl_cancelEvent(evnt);

	    var parentCell = igtbl_getParentCell(se);
	    if (!ig_csom.IsNetscape6 || !((se.tagName == "INPUT" && se.type == "text" || se.tagName == "TEXTAREA") && parentCell && (parentCell.Column.TemplatedColumn & 2)))
		    ig_cancelEvent(evnt);
	    var se = igtbl_dom.find.parentByTag(se, ["TD", "TH"]);
	    if (!se)
		    return;


	    var row;
	    var cell = igtbl_getCellByElement(se);
	    var id = gs._mouseID = se.id;
	    if (cell)
	    {
		    row = cell.Row;
		    id = cell.Element.id;
	    }
	    else row = igtbl_getRowById(id);
	    if (!row && !cell) return;
	    var fac = row.Band.firstActiveCell;
	    if (igtbl_fireEvent(gn, gs.Events.MouseDown, "(\"" + gn + "\",\"" + id + "\"," + igtbl_button(gn, evnt) + ")") == true)
	    {
		    igtbl_cancelEvent(evnt);
		    return true;
	    }
	    var band = row.Band;
	    var bandNo = band.Index;

	    if (igtbl_hideEdit(gn) && !((band.getSelectTypeCell() == 2 || band.getSelectTypeCell() == 3) && band.getCellClickAction() == 1 && cell && !cell.getSelected())) return;
	    if (igtbl_button(gn, evnt) == 0 && !cell && igtbl_getOffsetY(evnt, se) > igtbl_clientHeight(se) - 4 && igtbl_getRowSizing(gn, bandNo, row.Element) == 2 && !se.getAttribute("groupRow"))
	    {
		    gs.Element.setAttribute("elementMode", "resize");
		    gs.Element.setAttribute("resizeRow", row.Element.id);
		    row.Element.style.height = row.Element.offsetHeight;



		    ig_csom.addEventListener(document, "mousemove", igtbl_resizeRowMouseMove);
		    ig_csom.addEventListener(document, "mouseup", igtbl_resizeRowMouseUp);
	    }
	    else
	    {
		    var te = gs.Element;
		    var workTableId;
		    if (
		       (row.IsAddNewRow

			    || row.IsFilterRow
		        ) && row.Band.Index == 0)
			    workTableId = gs.Element.id;
		    else
			    if (se.getAttribute("groupRow"))
			    workTableId = se.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.id;
		    else
			    workTableId = row.Element.parentNode.parentNode.id;
		    if (igtbl_button(gn, evnt) != 0)
			    return;
		    if (workTableId == "")
			    return;

		    te.removeAttribute("lastSelectedCell");
		    var prevSelRow = gs.SelectedRows[igtbl_getWorkRow(row.Element, gn).id];
		    if (prevSelRow && igtbl_getLength(gs.SelectedRows) > 1)
			    prevSelRow = false;
		    var selPresent = (igtbl_getLength(gs.SelectedCells) > 0 ? 1 : 0) | (igtbl_getLength(gs.SelectedRows) > 0 ? 2 : 0) | (igtbl_getLength(gs.SelectedCols) > 0 ? 4 : 0);
		    if (se.getAttribute("groupRow") || !cell || igtbl_getCellClickAction(gn, bandNo) == 2)
		    {
			    if (!(igtbl_getSelectTypeRow(gn, bandNo) == 3 && (evnt.ctrlKey || evnt.metaKey)) && !(row.getSelected() && igtbl_getLength(gs.SelectedRows) == 1))
				    igtbl_clearSelectionAll(gn);
		    }
		    else
		    {
			    if (!(igtbl_getSelectTypeCell(gn, bandNo) == 3 && (evnt.ctrlKey || evnt.metaKey)) && !(cell.getSelected() && igtbl_getLength(gs.SelectedCells) == 1))
				    igtbl_clearSelectionAll(gn);
		    }
		    gs.Element.setAttribute("elementMode", "select");
		    if (se.getAttribute("groupRow"))
		    {
			    te.setAttribute("selectTable", se.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.id);
			    te.setAttribute("selectMethod", "row");
		    }
		    else
		    {
			    te.setAttribute("selectTable", workTableId);
			    if (!cell || igtbl_getCellClickAction(gn, bandNo) == 2)
				    te.setAttribute("selectMethod", "row");
			    else
				    te.setAttribute("selectMethod", "cell");
		    }
		    if (te.getAttribute("shiftSelect") && evnt.shiftKey)
			    igtbl_selectRegion(gn, se);
		    else
		    {
			    if (!cell || igtbl_getCellClickAction(gn, bandNo) == 2 || se.getAttribute("groupRow"))
			    {
				    var seRow = igtbl_getRowById(row.Element.id);
				    if (gs.SelectedRows[row.Element.id] && (evnt.ctrlKey || evnt.metaKey))
				    {
					    igtbl_selectRow(gn, seRow, false);
					    gs.setActiveRow(seRow);
				    }
				    else
				    {
					    var showEdit = true;
					    if (!gs._exitEditCancel)
					    {
						    if (gs.Activation.AllowActivation)
						    {
							    var ar = gs.oActiveRow;
							    if (ar != seRow)
							    {
								    gs.setActiveRow(seRow);
								    showEdit = false;
							    }
							    else
								    showEdit = true;
						    }
						    if (igtbl_getSelectTypeRow(gn, bandNo) > 1)
							    igtbl_selectRow(gn, seRow, true, !prevSelRow);
						    if (showEdit && !se.getAttribute("groupRow") && row)
							    row.editRow();
					    }
				    }
			    }
			    else
			    {
				    if (cell.getSelected() && (evnt.ctrlKey || evnt.metaKey))
				    {
					    cell.select(false);
					    cell.activate();
				    }
				    else
				    {
					    if (band.getSelectTypeCell() > 1 && band.getCellClickAction() >= 1 && !gs._exitEditCancel)
						    cell.select();
					    else if (selPresent)
					    {
						    var gsNPB = gs.NeedPostBack;
						    igtbl_fireEvent(gn, gs.Events.AfterSelectChange, "(\"" + gn + "\",\"" + id + "\");");
						    if (!gsNPB && !(gs.Events.AfterSelectChange[1] & selPresent))
							    gs.NeedPostBack = false;
					    }
					    cell.activate();
				    }
			    }
			    if (se.getAttribute("groupRow"))
				    te.setAttribute("startPointRow", se.parentNode.parentNode.parentNode.parentNode.parentNode.id);
			    else
				    te.setAttribute("startPointRow", row.Element.id);
			    te.setAttribute("startPointCell", id);
			    te.removeAttribute("shiftSelect");
			    if ((!evnt.ctrlKey && !evnt.metaKey))
				    te.setAttribute("shiftSelect", true);
		    }
	    }
	    if (typeof (igtbl_currentEditTempl) != "undefined" && igtbl_currentEditTempl != null)
		    igtbl_gRowEditMouseDown(evnt);
	    if (typeof (igcmbo_currentDropped) != "undefined" && igcmbo_currentDropped != null)
		    igcmbo_mouseDown(evnt);
    }
});