From 430d83956928193245d22aba652e540060502a53 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 12 Oct 2008 00:29:09 +0000 Subject: #231475 by birdmanx35 and redndahead: Coding style for comments in *.js. --- misc/autocomplete.js | 88 ++++++++++++++++++++++++++-------------------------- misc/drupal.js | 20 ++++++------ misc/progress.js | 8 ++--- misc/tabledrag.js | 2 +- misc/tableheader.js | 2 +- misc/teaser.js | 6 ++-- 6 files changed, 63 insertions(+), 63 deletions(-) (limited to 'misc') diff --git a/misc/autocomplete.js b/misc/autocomplete.js index 4741de727..6efcf1e26 100644 --- a/misc/autocomplete.js +++ b/misc/autocomplete.js @@ -1,7 +1,7 @@ // $Id$ /** - * Attaches the autocomplete behavior to all required fields + * Attaches the autocomplete behavior to all required fields. */ Drupal.behaviors.autocomplete = function (context) { var acdb = []; @@ -29,7 +29,7 @@ Drupal.autocompleteSubmit = function () { }; /** - * An AutoComplete object + * An AutoComplete object. */ Drupal.jsAC = function (input, db) { var ac = this; @@ -44,53 +44,53 @@ Drupal.jsAC = function (input, db) { }; /** - * Handler for the "keydown" event + * Handler for the "keydown" event. */ Drupal.jsAC.prototype.onkeydown = function (input, e) { if (!e) { e = window.event; } switch (e.keyCode) { - case 40: // down arrow + case 40: // down arrow. this.selectDown(); return false; - case 38: // up arrow + case 38: // up arrow. this.selectUp(); return false; - default: // all other keys + default: // All other keys. return true; } }; /** - * Handler for the "keyup" event + * Handler for the "keyup" event. */ Drupal.jsAC.prototype.onkeyup = function (input, e) { if (!e) { e = window.event; } switch (e.keyCode) { - case 16: // shift - case 17: // ctrl - case 18: // alt - case 20: // caps lock - case 33: // page up - case 34: // page down - case 35: // end - case 36: // home - case 37: // left arrow - case 38: // up arrow - case 39: // right arrow - case 40: // down arrow + case 16: // shift. + case 17: // ctrl. + case 18: // alt. + case 20: // caps lock. + case 33: // page up. + case 34: // page down. + case 35: // end. + case 36: // home. + case 37: // left arrow. + case 38: // up arrow. + case 39: // right arrow. + case 40: // down arrow. return true; - case 9: // tab - case 13: // enter - case 27: // esc + case 9: // tab. + case 13: // enter. + case 27: // esc. this.hidePopup(e.keyCode); return true; - default: // all other keys + default: // All other keys. if (input.value.length > 0) this.populatePopup(); else @@ -100,14 +100,14 @@ Drupal.jsAC.prototype.onkeyup = function (input, e) { }; /** - * Puts the currently highlighted suggestion into the autocomplete field + * Puts the currently highlighted suggestion into the autocomplete field. */ Drupal.jsAC.prototype.select = function (node) { this.input.value = node.autocompleteValue; }; /** - * Highlights the next suggestion + * Highlights the next suggestion. */ Drupal.jsAC.prototype.selectDown = function () { if (this.selected && this.selected.nextSibling) { @@ -122,7 +122,7 @@ Drupal.jsAC.prototype.selectDown = function () { }; /** - * Highlights the previous suggestion + * Highlights the previous suggestion. */ Drupal.jsAC.prototype.selectUp = function () { if (this.selected && this.selected.previousSibling) { @@ -131,7 +131,7 @@ Drupal.jsAC.prototype.selectUp = function () { }; /** - * Highlights a suggestion + * Highlights a suggestion. */ Drupal.jsAC.prototype.highlight = function (node) { if (this.selected) { @@ -142,7 +142,7 @@ Drupal.jsAC.prototype.highlight = function (node) { }; /** - * Unhighlights a suggestion + * Unhighlights a suggestion. */ Drupal.jsAC.prototype.unhighlight = function (node) { $(node).removeClass('selected'); @@ -150,14 +150,14 @@ Drupal.jsAC.prototype.unhighlight = function (node) { }; /** - * Hides the autocomplete suggestions + * Hides the autocomplete suggestions. */ Drupal.jsAC.prototype.hidePopup = function (keycode) { - // Select item if the right key or mousebutton was pressed + // Select item if the right key or mousebutton was pressed. if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) { this.input.value = this.selected.autocompleteValue; } - // Hide popup + // Hide popup. var popup = this.popup; if (popup) { this.popup = null; @@ -167,10 +167,10 @@ Drupal.jsAC.prototype.hidePopup = function (keycode) { }; /** - * Positions the suggestions popup and starts a search + * Positions the suggestions popup and starts a search. */ Drupal.jsAC.prototype.populatePopup = function () { - // Show popup + // Show popup. if (this.popup) { $(this.popup).remove(); } @@ -185,13 +185,13 @@ Drupal.jsAC.prototype.populatePopup = function () { }); $(this.input).before(this.popup); - // Do search + // Do search. this.db.owner = this; this.db.search(this.input.value); }; /** - * Fills the suggestion popup with any matches received + * Fills the suggestion popup with any matches received. */ Drupal.jsAC.prototype.found = function (matches) { // If no value in the textfield, do not show the popup. @@ -199,7 +199,7 @@ Drupal.jsAC.prototype.found = function (matches) { return false; } - // Prepare matches + // Prepare matches. var ul = document.createElement('ul'); var ac = this; for (key in matches) { @@ -213,7 +213,7 @@ Drupal.jsAC.prototype.found = function (matches) { $(ul).append(li); } - // Show popup with matches, if any + // Show popup with matches, if any. if (this.popup) { if (ul.childNodes.length > 0) { $(this.popup).empty().append(ul).show(); @@ -239,7 +239,7 @@ Drupal.jsAC.prototype.setStatus = function (status) { }; /** - * An AutoComplete DataBase object + * An AutoComplete DataBase object. */ Drupal.ACDB = function (uri) { this.uri = uri; @@ -248,25 +248,25 @@ Drupal.ACDB = function (uri) { }; /** - * Performs a cached and delayed search + * Performs a cached and delayed search. */ Drupal.ACDB.prototype.search = function (searchString) { var db = this; this.searchString = searchString; - // See if this key has been searched for before + // See if this key has been searched for before. if (this.cache[searchString]) { return this.owner.found(this.cache[searchString]); } - // Initiate delayed search + // Initiate delayed search. if (this.timer) { clearTimeout(this.timer); } this.timer = setTimeout(function() { db.owner.setStatus('begin'); - // Ajax GET request for autocompletion + // Ajax GET request for autocompletion. $.ajax({ type: "GET", url: db.uri +'/'+ Drupal.encodeURIComponent(searchString), @@ -274,7 +274,7 @@ Drupal.ACDB.prototype.search = function (searchString) { success: function (matches) { if (typeof matches['status'] == 'undefined' || matches['status'] != 0) { db.cache[searchString] = matches; - // Verify if these are still the matches the user wants to see + // Verify if these are still the matches the user wants to see. if (db.searchString == searchString) { db.owner.found(matches); } @@ -289,7 +289,7 @@ Drupal.ACDB.prototype.search = function (searchString) { }; /** - * Cancels the current autocomplete request + * Cancels the current autocomplete request. */ Drupal.ACDB.prototype.cancel = function() { if (this.owner) this.owner.setStatus('cancel'); diff --git a/misc/drupal.js b/misc/drupal.js index 08e720ca0..4cb99bd99 100644 --- a/misc/drupal.js +++ b/misc/drupal.js @@ -3,7 +3,7 @@ var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} }; /** - * Set the variable that indicates if JavaScript behaviors should be applied + * Set the variable that indicates if JavaScript behaviors should be applied. */ Drupal.jsEnabled = document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById; @@ -80,17 +80,17 @@ Drupal.t = function(str, args) { } if (args) { - // Transform arguments before inserting them + // Transform arguments before inserting them. for (var key in args) { switch (key.charAt(0)) { - // Escaped only + // Escaped only. case '@': args[key] = Drupal.checkPlain(args[key]); break; - // Pass-through + // Pass-through. case '!': break; - // Escaped and placeholder + // Escaped and placeholder. case '%': default: args[key] = Drupal.theme('placeholder', args[key]); @@ -209,7 +209,7 @@ Drupal.freezeHeight = function () { }; /** - * Unfreeze the body height + * Unfreeze the body height. */ Drupal.unfreezeHeight = function () { $('#freeze-height').remove(); @@ -230,7 +230,7 @@ Drupal.encodeURIComponent = function (item, uri) { */ Drupal.getSelection = function (element) { if (typeof(element.selectionStart) != 'number' && document.selection) { - // The current selection + // The current selection. var range1 = document.selection.createRange(); var range2 = range1.duplicate(); // Select all text. @@ -263,11 +263,11 @@ Drupal.ahahError = function(xmlhttp, uri) { return message; } -// Global Killswitch on the element +// Global Killswitch on the element. if (Drupal.jsEnabled) { - // Global Killswitch on the element + // Global Killswitch on the element. $(document.documentElement).addClass('js'); - // 'js enabled' cookie + // 'js enabled' cookie. document.cookie = 'has_js=1; path=/'; // Attach all behaviors. $(document).ready(function() { diff --git a/misc/progress.js b/misc/progress.js index 4a7ee3cfe..631a5f4f8 100644 --- a/misc/progress.js +++ b/misc/progress.js @@ -53,7 +53,7 @@ Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { */ Drupal.progressBar.prototype.stopMonitoring = function () { clearTimeout(this.timer); - // This allows monitoring to be stopped from within the callback + // This allows monitoring to be stopped from within the callback. this.uri = null; }; @@ -74,14 +74,14 @@ Drupal.progressBar.prototype.sendPing = function () { data: '', dataType: 'json', success: function (progress) { - // Display errors + // Display errors. if (progress.status == 0) { pb.displayError(progress.data); return; } - // Update display + // Update display. pb.setProgress(progress.percentage, progress.message); - // Schedule next timer + // Schedule next timer. pb.timer = setTimeout(function() { pb.sendPing(); }, pb.delay); }, error: function (xmlhttp) { diff --git a/misc/tabledrag.js b/misc/tabledrag.js index 94c259da3..d8c1e6e9a 100644 --- a/misc/tabledrag.js +++ b/misc/tabledrag.js @@ -275,7 +275,7 @@ Drupal.tableDrag.prototype.makeDraggable = function(item) { keyChange = true; if ($(item).is('.tabledrag-root')) { - // Swap with the previous top-level row.. + // Swap with the previous top-level row. var groupHeight = 0; while (previousRow && $('.indentation', previousRow).size()) { previousRow = $(previousRow).prev('tr').get(0); diff --git a/misc/tableheader.js b/misc/tableheader.js index 7f01d026f..3127464d8 100644 --- a/misc/tableheader.js +++ b/misc/tableheader.js @@ -105,7 +105,7 @@ Drupal.behaviors.tableHeader = function (context) { this.viewHeight = 0; tracker(this); }); - // Reset timer + // Reset timer. time = null; }, 250); }; diff --git a/misc/teaser.js b/misc/teaser.js index 6a4a341d1..590dad582 100644 --- a/misc/teaser.js +++ b/misc/teaser.js @@ -56,10 +56,10 @@ Drupal.behaviors.teaser = function(context) { // Note: using val() fails sometimes. jQuery bug? teaser[0].value = trim(text.slice(0, split)); body[0].value = trim(text.slice(split)); - // Reveal and enable teaser + // Reveal and enable teaser. $(teaser).attr('disabled', ''); $(teaser).parent().slideDown('fast'); - // Change label + // Change label. $(this).val(Drupal.t('Join summary')); // Show separate teaser checkbox, restore checked value. $(checkbox).show().children('input').attr('checked', checked); @@ -87,7 +87,7 @@ Drupal.behaviors.teaser = function(context) { if (Drupal.behaviors.textarea && teaser.is(('.form-textarea:not(.textarea-processed)'))) { Drupal.behaviors.textarea(teaser.parentNode); } - // Set initial visibility + // Set initial visibility. if ($(teaser).is('[@disabled]')) { $(teaser).parent().hide(); } -- cgit v1.2.3