Problems to handle Java Script - Upgrading to Elgg 2.11

First, I am a bad coder und I did'nt not realy understand how Elgg manages Java Script code but I found in my old Elgg version 1.8 a solution to bind Java Script for my purpose and Java Script works in my pages.
I use a lot of external Java code e. g. the Wijmo framework and raphael framework.
How I
initiate Java Script in my plugin, see at the end of this text.
My question is now, what is the easiest way and best practice to bind Java Script in Elgg 2.1 ?
I found and read a lot of documentation in that topic and I try as simple as possible with the custom-index plugin to figure out, how it could work, but without success.

---------------------------------------------------------------------------------------------------------------------
I
initiate the libraries in my plugin which is named "audit" in the start.php in this way:

// register the audit's JavaScript
$audit_js = elgg_get_simplecache_url ('js', 'audit/save_draft');
elgg_register_simplecache_view ('js/audit/save_draft');
elgg_register_js ('elgg.audit', $audit_js);

// load CSSand JS
$css_url = 'mod/audit/vendors/external/themes/aristo/jquery-wijmo.css';
elgg_register_css ('wijmo-css', $css_url, 1);
elgg_load_css ('wijmo-css');

$css_url = 'mod/audit/vendors/external/themes/wijmo/jquery.wijmo-open.2.1.4.css';
elgg_register_css ('wijmo-open-css', $css_url, 500);
elgg_load_css ('wijmo-open-css');

$js_url = 'mod/audit/vendors/external/jquery.wijmo-open.all.2.1.4.min.js';
elgg_register_js ('wijmo-open', $js_url, 'head', 500);
elgg_load_js ('wijmo-open');

$js_url = 'mod/audit/vendors/external/jquery-1.7.1.min.js';
elgg_register_js ('core-widget', $js_url, 'head', 500);
elgg_load_js ('core-wijmo-jquery');

$js_url = 'mod/audit/vendors/external/raphael-min.js';
elgg_register_js ('raphael-min', $js_url, 'head', 500);
elgg_load_js ('raphael-min');

. . . . . . and so on
-----------------------------------------------------------------------------------------------


The Source of the page which displays the data I use the Script Code like this:

<script type="text/javascript">

$(document).ready(function () {
$('#checkbox1').wijcheckbox();
$('#checkbox1').click(checkexpertmodus);
$('#output-pic-matrix').show();

<?php set_input('expertenmodus', True) ?>

var proxy2 = new wijhttpproxy({

url: "<?php echo $elgg_site_url ?>/audit/db_audittyp",
dataType: "json",
data: {
featureClass: "P",
style: "full",
maxRows: 1,
},
key: 'audits
});

var myReader2 = new wijarrayreader([{
name: 'label',
mapping: function (item) {
return item.name
} . . .

. . . . . . and so on
-----------------------------------------------------------------------------------------------

 

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking