diff options
-rw-r--r-- | documentation/coding_standards/javascript_coding_standards.txt | 11 | ||||
-rw-r--r-- | js/lib/avatar_cropper.js | 6 | ||||
-rw-r--r-- | js/lib/configuration.js | 2 | ||||
-rw-r--r-- | js/lib/elgglib.js | 8 | ||||
-rw-r--r-- | js/lib/hooks.js | 8 | ||||
-rw-r--r-- | js/lib/ui.js | 14 | ||||
-rw-r--r-- | js/lib/ui.widgets.js | 12 | ||||
-rw-r--r-- | js/lib/userpicker.js | 10 | ||||
-rw-r--r-- | mod/blog/views/default/js/blog/save_draft.php | 4 | ||||
-rw-r--r-- | mod/bookmarks/views/default/bookmarks/js.php | 2 | ||||
-rw-r--r-- | mod/developers/views/default/js/developers/developers.php | 4 | ||||
-rw-r--r-- | mod/embed/views/default/js/embed/embed.php | 8 | ||||
-rw-r--r-- | mod/messageboard/views/default/messageboard/js.php | 6 | ||||
-rw-r--r-- | mod/thewire/views/default/js/thewire.php | 6 | ||||
-rw-r--r-- | mod/tinymce/views/default/js/tinymce.php | 4 | ||||
-rw-r--r-- | mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php | 2 |
16 files changed, 59 insertions, 48 deletions
diff --git a/documentation/coding_standards/javascript_coding_standards.txt b/documentation/coding_standards/javascript_coding_standards.txt index 7d3b842ec..9939e80ab 100644 --- a/documentation/coding_standards/javascript_coding_standards.txt +++ b/documentation/coding_standards/javascript_coding_standards.txt @@ -1,2 +1,13 @@ *** JAVASCRIPT CODING STANDARDS *** +* Same formatting standards as PHP. + +* All functions should be in the elgg namespace. + +* Function expressions should end with a semi-colon: + + elgg.ui.toggles = function(event) { + event.preventDefault(); + $(target).slideToggle('medium'); + }; + diff --git a/js/lib/avatar_cropper.js b/js/lib/avatar_cropper.js index df6ba7866..fc32a0832 100644 --- a/js/lib/avatar_cropper.js +++ b/js/lib/avatar_cropper.js @@ -32,7 +32,7 @@ elgg.avatarCropper.init = function() { var selection = ias.getSelection(); elgg.avatarCropper.preview($('#user-avatar-cropper'), selection); } -} +}; /** * Handler for changing select area. @@ -57,7 +57,7 @@ elgg.avatarCropper.preview = function(img, selection) { marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' }); -} +}; /** * Handler for updating the form inputs after select ends @@ -71,6 +71,6 @@ elgg.avatarCropper.selectChange = function(img, selection) { $('input[name=x2]').val(selection.x2); $('input[name=y1]').val(selection.y1); $('input[name=y2]').val(selection.y2); -} +}; elgg.register_hook_handler('init', 'system', elgg.avatarCropper.init);
\ No newline at end of file diff --git a/js/lib/configuration.js b/js/lib/configuration.js index f724a2f01..6e221c957 100644 --- a/js/lib/configuration.js +++ b/js/lib/configuration.js @@ -7,4 +7,4 @@ elgg.provide('elgg.config'); */ elgg.get_site_url = function() { return elgg.config.wwwroot; -}
\ No newline at end of file +};
\ No newline at end of file diff --git a/js/lib/elgglib.js b/js/lib/elgglib.js index 628adccfc..d963a62be 100644 --- a/js/lib/elgglib.js +++ b/js/lib/elgglib.js @@ -467,7 +467,7 @@ elgg.parse_url = function(url, component, expand) { } } return results; -} +}; /** * Returns an object with key/values of the parsed query string. @@ -540,7 +540,7 @@ elgg.push_to_object_array = function(object, parent, value) { } return false; -} +}; /** * Tests if object[parent] contains child @@ -554,7 +554,7 @@ elgg.is_in_object_array = function(object, parent, value) { elgg.assertTypeOf('string', parent); return typeof(object[parent]) != 'undefined' && object[parent].indexOf(value) >= 0; -} +}; /** * Triggers the init hook when the library is ready @@ -569,4 +569,4 @@ elgg.initWhenReady = function() { elgg.trigger_hook('init', 'system'); elgg.trigger_hook('ready', 'system'); } -}
\ No newline at end of file +};
\ No newline at end of file diff --git a/js/lib/hooks.js b/js/lib/hooks.js index edfd28f24..7bac471f6 100644 --- a/js/lib/hooks.js +++ b/js/lib/hooks.js @@ -136,7 +136,7 @@ elgg.register_instant_hook = function(name, type) { elgg.assertTypeOf('string', type); return elgg.push_to_object_array(elgg.config.instant_hooks, name, type); -} +}; /** * Is this hook registered as an instant hook? @@ -146,7 +146,7 @@ elgg.register_instant_hook = function(name, type) { */ elgg.is_instant_hook = function(name, type) { return elgg.is_in_object_array(elgg.config.instant_hooks, name, type); -} +}; /** * Records that a hook has been triggered. @@ -156,7 +156,7 @@ elgg.is_instant_hook = function(name, type) { */ elgg.set_triggered_hook = function(name, type) { return elgg.push_to_object_array(elgg.config.triggered_hooks, name, type); -} +}; /** * Has this hook been triggered yet? @@ -166,7 +166,7 @@ elgg.set_triggered_hook = function(name, type) { */ elgg.is_triggered_hook = function(name, type) { return elgg.is_in_object_array(elgg.config.triggered_hooks, name, type); -} +}; elgg.register_instant_hook('init', 'system'); elgg.register_instant_hook('ready', 'system'); diff --git a/js/lib/ui.js b/js/lib/ui.js index 6cc1bc78a..16ef2dc96 100644 --- a/js/lib/ui.js +++ b/js/lib/ui.js @@ -25,7 +25,7 @@ elgg.ui.init = function () { if ($('.elgg-input-date').length) { elgg.ui.initDatePicker(); } -} +}; /** * Toggles an element based on clicking a separate element @@ -43,7 +43,7 @@ elgg.ui.toggles = function(event) { var target = $(this).toggleClass('elgg-state-active').attr('href'); $(target).slideToggle('medium'); -} +}; /** * Pops up an element based on clicking a separate element @@ -105,7 +105,7 @@ elgg.ui.popsUp = function(event) { $('body') .die('click', elgg.ui.popupClose) .live('click', elgg.ui.popupClose); -} +}; /** * Catches clicks that aren't in a popup and closes all popups. @@ -143,7 +143,7 @@ elgg.ui.popupClose = function(event) { $('body').die('click', elgg.ui.popClose); } -} +}; /** * Toggles a child menu when the parent is clicked @@ -155,7 +155,7 @@ elgg.ui.toggleMenu = function(event) { $(this).siblings().slideToggle('medium'); $(this).toggleClass('elgg-menu-closed elgg-menu-opened'); event.preventDefault(); -} +}; /** * Initialize the hover menu @@ -215,7 +215,7 @@ elgg.ui.initHoverMenu = function(parent) { $(".elgg-menu-hover").fadeOut(); } }); -} +}; /** * Calls a confirm() and prevents default if denied. @@ -276,7 +276,7 @@ elgg.ui.initDatePicker = function() { } } }); -} +}; elgg.register_hook_handler('init', 'system', elgg.ui.init); elgg.register_hook_handler('getOptions', 'ui.popup', elgg.ui.LoginHandler);
\ No newline at end of file diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index fb256672a..6435d2147 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -65,7 +65,7 @@ elgg.ui.widgets.add = function(event) { } }); event.preventDefault(); -} +}; /** * Persist the widget's new position @@ -96,7 +96,7 @@ elgg.ui.widgets.move = function(event, ui) { // @hack fixes jquery-ui/opera bug where draggable elements jump ui.item.css('top', 0); ui.item.css('left', 0); -} +}; /** * Removes a widget from the layout @@ -134,7 +134,7 @@ elgg.ui.widgets.remove = function(event) { } }); event.preventDefault(); -} +}; /** * Toggle the collapse state of the widget @@ -146,7 +146,7 @@ elgg.ui.widgets.collapseToggle = function(event) { $(this).toggleClass('elgg-widget-collapsed'); $(this).parent().parent().find('.elgg-body').slideToggle('medium'); event.preventDefault(); -} +}; /** * Save a widget's settings @@ -178,7 +178,7 @@ elgg.ui.widgets.saveSettings = function(event) { } }); event.preventDefault(); -} +}; /** * Make all elements have the same min-height @@ -197,6 +197,6 @@ elgg.ui.widgets.equalHeight = function(selector) { } }) $(selector).css('min-height', maxHeight); -} +}; elgg.register_hook_handler('init', 'system', elgg.ui.widgets.init); diff --git a/js/lib/userpicker.js b/js/lib/userpicker.js index ae2add53f..8287ba91c 100644 --- a/js/lib/userpicker.js +++ b/js/lib/userpicker.js @@ -34,7 +34,7 @@ elgg.userpicker.init = function() { }); $('.elgg-userpicker-remove').live('click', elgg.userpicker.removeUser); -} +}; /** * Adds a user to the select user list @@ -59,7 +59,7 @@ elgg.userpicker.addUser = function(event, ui) { $(this).val(''); event.preventDefault(); -} +}; /** * Remove a user from the selected user list @@ -75,7 +75,7 @@ elgg.userpicker.removeUser = function(event) { item.remove(); event.preventDefault(); -} +}; /** * Render the list item for insertion into the selected user list @@ -96,7 +96,7 @@ elgg.userpicker.viewUser = function(info) { html += "</div"; return html; -} +}; /** * Get the parameters to use for autocomplete @@ -112,6 +112,6 @@ elgg.userpicker.getSearchParams = function(obj) { } else { return {'match_on[]': 'users', 'term' : obj.term}; } -} +}; elgg.register_hook_handler('init', 'system', elgg.userpicker.init);
\ No newline at end of file diff --git a/mod/blog/views/default/js/blog/save_draft.php b/mod/blog/views/default/js/blog/save_draft.php index fd76c870c..8a994ffb0 100644 --- a/mod/blog/views/default/js/blog/save_draft.php +++ b/mod/blog/views/default/js/blog/save_draft.php @@ -28,7 +28,7 @@ elgg.blog.saveDraftCallback = function(data, textStatus, XHR) { } else { $(".blog-save-status-time").html(elgg.echo('error')); } -} +}; elgg.blog.saveDraft = function() { if (typeof(tinyMCE) != 'undefined') { @@ -55,7 +55,7 @@ elgg.blog.saveDraft = function() { }); $.post(draftURL, postData, elgg.blog.saveDraftCallback, 'json'); -} +}; elgg.blog.init = function() { // get a copy of the body to compare for auto save diff --git a/mod/bookmarks/views/default/bookmarks/js.php b/mod/bookmarks/views/default/bookmarks/js.php index 0e55c510a..c36823c09 100644 --- a/mod/bookmarks/views/default/bookmarks/js.php +++ b/mod/bookmarks/views/default/bookmarks/js.php @@ -7,6 +7,6 @@ elgg.bookmarks.init = function() { var e = $('a.elgg-bookmark-page'); var link = e.attr('href') + '&title=' + encodeURIComponent(title); e.attr('href', link); -} +}; elgg.register_hook_handler('init', 'system', elgg.bookmarks.init); diff --git a/mod/developers/views/default/js/developers/developers.php b/mod/developers/views/default/js/developers/developers.php index 09e6ddd12..6e82295aa 100644 --- a/mod/developers/views/default/js/developers/developers.php +++ b/mod/developers/views/default/js/developers/developers.php @@ -8,7 +8,7 @@ elgg.provide('elgg.dev'); elgg.dev.init = function() { $('.developers-form-inspect').live('submit', elgg.dev.inspectSubmit); -} +}; /** * Submit the inspect form through Ajax @@ -39,6 +39,6 @@ elgg.dev.inspectSubmit = function(event) { }); event.preventDefault(); -} +}; elgg.register_hook_handler('init', 'system', elgg.dev.init);
\ No newline at end of file diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index 3126e12f7..8e543ac37 100644 --- a/mod/embed/views/default/js/embed/embed.php +++ b/mod/embed/views/default/js/embed/embed.php @@ -19,7 +19,7 @@ elgg.embed.init = function() { $('.embed-section').live('click', elgg.embed.forward); $('.elgg-form-embed').live('submit', elgg.embed.submit); -} +}; /** * Inserts data attached to an embed list item in textarea @@ -48,7 +48,7 @@ elgg.embed.insert = function(event) { $.fancybox.close(); event.preventDefault(); -} +}; /** * Submit an upload form through Ajax @@ -85,7 +85,7 @@ elgg.embed.submit = function(event) { // this was bubbling up the DOM causing a submission event.preventDefault(); event.stopPropagation(); -} +}; /** * Loads content within the lightbox @@ -96,6 +96,6 @@ elgg.embed.submit = function(event) { elgg.embed.forward = function(event) { $('.embed-wrapper').parent().load($(this).attr('href')); event.preventDefault(); -} +}; elgg.register_hook_handler('init', 'system', elgg.embed.init); diff --git a/mod/messageboard/views/default/messageboard/js.php b/mod/messageboard/views/default/messageboard/js.php index e5495409a..3295c68de 100644 --- a/mod/messageboard/views/default/messageboard/js.php +++ b/mod/messageboard/views/default/messageboard/js.php @@ -13,7 +13,7 @@ elgg.messageboard.init = function() { // double whammy for in case the load order changes. .unbind('click', elgg.ui.requiresConfirmation) .removeClass('elgg-requires-confirmation'); -} +}; elgg.messageboard.submit = function(e) { var form = $(this).parents('form'); @@ -35,7 +35,7 @@ elgg.messageboard.submit = function(e) { }); e.preventDefault(); -} +}; elgg.messageboard.deletePost = function(e) { var link = $(this); @@ -50,6 +50,6 @@ elgg.messageboard.deletePost = function(e) { } e.preventDefault(); -} +}; elgg.register_hook_handler('init', 'system', elgg.messageboard.init); diff --git a/mod/thewire/views/default/js/thewire.php b/mod/thewire/views/default/js/thewire.php index d9bf6d10e..0a6eba134 100644 --- a/mod/thewire/views/default/js/thewire.php +++ b/mod/thewire/views/default/js/thewire.php @@ -18,7 +18,7 @@ elgg.thewire.init = function() { }); $(".thewire-previous").live('click', elgg.thewire.viewPrevious); -} +}; /** * Update the number of characters left with every keystroke @@ -42,7 +42,7 @@ elgg.thewire.textCounter = function(textarea, status, limit) { $("#thewire-submit-button").removeAttr('disabled', 'disabled'); $("#thewire-submit-button").removeClass('elgg-state-disabled'); } -} +}; /** * Display the previous wire post @@ -81,6 +81,6 @@ elgg.thewire.viewPrevious = function(event) { } event.preventDefault(); -} +}; elgg.register_hook_handler('init', 'system', elgg.thewire.init); diff --git a/mod/tinymce/views/default/js/tinymce.php b/mod/tinymce/views/default/js/tinymce.php index 55e0c7ae1..c6973d878 100644 --- a/mod/tinymce/views/default/js/tinymce.php +++ b/mod/tinymce/views/default/js/tinymce.php @@ -18,7 +18,7 @@ elgg.tinymce.toggleEditor = function(event) { tinyMCE.execCommand('mceRemoveControl', false, id); $(this).html(elgg.echo('tinymce:add')); } -} +}; /** * TinyMCE initialization script @@ -69,6 +69,6 @@ elgg.tinymce.init = function() { content_css: elgg.config.wwwroot + 'mod/tinymce/css/elgg_tinymce.css' }); -} +}; elgg.register_hook_handler('init', 'system', elgg.tinymce.init);
\ No newline at end of file diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php index abd29c0e1..50c98406e 100644 --- a/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php +++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php @@ -23,6 +23,6 @@ elgg.uservalidationbyemail.init = function() { $form.attr('action', $(this).attr('href')).submit(); }); -} +}; elgg.register_hook_handler('init', 'system', elgg.uservalidationbyemail.init); |