klenwell information services : Javascript

Revision history for Javascript


Revision [3138]

Last edited on 2018-09-03 00:52:46 by KlenwellAdmin
Additions:
==== jQuery ====
Use one of the following patterns for jQuery:

=== Module ===
The module is best used for modules where the abstraction is centralized and does not require multiple instantiations (as with a class object).

~- Source: https://learn.jquery.com/code-organization/concepts/#the-module-pattern
~- Example: https://github.com/chapmanu/cascade-assets/blob/development/app/assets/javascripts/omni_nav/omni-nav-v2.js

=== Plugin ===
To build your own classic jQuery plugin that can be used like so: ""<tt>$('div').foo()</tt>""

~- Source: https://github.com/jquery-boilerplate/jquery-boilerplate/blob/master/src/jquery.boilerplate.js
~- Example: TBA

=== Web Widget ===
To build a centralized widget pushed out to multiple sites (e.g. Disqus comment forms).

~- Source: http://alexmarandon.com/articles/web_widget_jquery/
~- Example: TBA


Revision [3137]

Edited on 2018-09-03 00:45:22 by KlenwellAdmin
Additions:
===== Javascript =====
Deletions:


Revision [412]

Edited on 2007-04-18 13:42:58 by KlenwellAdmin
Deletions:
=====""DomHandler""=====
""DomHandler"" is a javascript class for creating structured blocks of html using DOM for the dynamic manipulation of web pages.
**license** : [[http://www.opensource.org/licenses/gpl-license.php GPL2]]
**source** : [[http://klenwell.googlecode.com/svn/trunk/JS/domhandler/ google code]]
**demo** : [[http://klenwell.googlepages.com/demo.domhandler.htm klenwell.googlepages.com]]
====Sample Usage====
**working example**
the code below is the actual code from [[http://klenwell.googlepages.com/demo.domhandler.htm the demo]] listed above
%%(javascript)
<!-- HEAD -->
<script type="text/javascript" src="http://klenwell.googlecode.com/svn/trunk/JS/domhandler/domhandler.ini.js"></script>
<!-- BODY -->
<script type="text/javascript">
// create DomHandler object
var MyHandler = new DomHandler(1);
MyHandler.ini();
var blocks_added = 0;
function add_element()
{
if ( blocks_added < 3 )
{
blocks_added++;
var block_id = "ubody_" + blocks_added;
MyHandler.add_element(MyHandler.core, 'p', block_id);
MyHandler.set_html(block_id, 'extra block #' + blocks_added);
}
else
{
alert('this can only be done ' + blocks_added + ' times!');
}
}
MyHandler.add_element(MyHandler.core, 'h4', 'utitle');
MyHandler.add_element(MyHandler.core, 'div', 'ubody');
MyHandler.add_element(MyHandler.container, 'h6', 'ufooter');
MyHandler.set_html('utitle', 'title block');
MyHandler.set_html('ubody', 'body block');
MyHandler.set_html('ufooter', 'click here to add another block');
// add event handler to footer
function uEvent() { add_element(); }
MyHandler.attach_event('ufooter', 'click', uEvent);
MyHandler.publish('script_block');
</script>
</div>
%%
----
CategoryJavascript


Revision [404]

Edited on 2007-04-15 17:21:44 by KlenwellAdmin
Additions:
=====""DomHandler""=====
""DomHandler"" is a javascript class for creating structured blocks of html using DOM for the dynamic manipulation of web pages.
Deletions:
=====DomHandler=====
DomHandler is a javascript class for creating structured blocks of html using DOM for the dynamic manipulation of web pages.


Revision [403]

The oldest known version of this page was created on 2007-04-15 17:20:49 by KlenwellAdmin