CNET javascript update (r90)
I released a lot of code today including a bug fix that was probably pestering any of you with r87.
- product.picker.js now has no picklets; these are in the implementations/picklets directory
- ProductPicker now detects if there is no doctyp and, if not, sets the position of the picker to be fixed (no IE6 support)
- small docs update in element.cnet.js
- added new picklet: CNETProductPicker_PricePath
- added new picklet: NewsStoryPicker_Path
- new file: clipboard.js (allows you to insert text into the OS clipboard)
- new file: html.table.js (automates building html tables)
- new file: element.forms.js (for managing text inputs - get selected text information, insert content around selection, etc.)
- fixed an error in stickyWinHTML (ie reserves “class” for member names)
- converted window.onDomReady references to window.addEvent(’domready’..
- updated css for stickyWin.js to avoid namespace conflicts with the css class “clearfix”
New functionality includes these new files:
clipboard.js
Let’s you copy stuff to the user’s OS clipboard:
Clipboard.copy('this is now on your clipboard');
/*
this example will copy what you select in the input above;
run this code, then select some text, and it will be on your clipboard */
$('clipboardExample').addEvent('click', function(){
Clipboard.copyFromElement('clipboardExample');
});
element.forms.js
This library helps manage text area and input manipulation. Functions include:
Element.getTextInRange, getSelectedText, getSelectedRange, selectRange, insertAtCursor, and insertAround.
text in range (click the input to execute):
selected text (select some text to execute): getSelectedRange: (select some text to execute)selectRange (click to execute; this example passes in an array [2,5]):
selectRange (click to execute; selectRange also will take two integers; this example passes in ‘2,5′):
insertAtCursor (click anywhere to insert the example):
insertAround (select some text or click anywhere to insert “<" and ">” around the text):
html.table.js
This just automates creating tables for tabular data.
var myTable = new HtmlTable({
properties: {
border: 1,
cellspacing: 3
},
rows: [
['apple', 'red'],
['lemon', 'yellow']
]
});
myTable.table.injectInside($('exampleHtmlTable'));
myTable.push(['lime', 'green']);
myTable.push(['grape', 'purple']);
You can also pass in a more sophisticated row element:
var myTable = new HtmlTable({
properties: {
border: 1,
cellspacing: 3
},
rows: [
[{content: 'fruits', properties: {colspan: 2, class: "someCssClass", style: "border: 1px solid blue"}}],
['apple', 'red'],
['lemon', 'yellow']
]
});
myTable.table.injectInside($('exampleHtmlTable2'));

May 17th, 2007 at 2:28 am
Great stuff again! I especially like the clipboard stuff, looks like it could come in handy!
May 17th, 2007 at 6:29 am
Sounds great…
But I must be stupid: can’t find a link to download your libs.
Can someone help ?
Thanks.
May 17th, 2007 at 7:17 am
Hi Victor,
I’ve added links to the docs, tutorials, and svn. You can also find these by browsing into the “libraries” section in the nav at the top of the page.
May 17th, 2007 at 11:37 pm
Thanks Aaron,
I first saw only the “download” tab in GC and all deprecated code.
I am new to mootools but find it really addicting and your script really how it can be easily extended.