Author: jablko
Date: Fri Oct 15 13:02:57 2010
New Revision: 8163
Log:
Drop unused String.prototype.trim()
Modified:
trunk/js/dialog.js
Modified: trunk/js/dialog.js
==============================================================================
--- trunk/js/dialog.js Fri Oct 15 13:01:37 2010 (r8162)
+++ trunk/js/dialog.js Fri Oct 15 13:02:57 2010 (r8163)
@@ -4,14 +4,6 @@
* Extra String methods
*/
-String.prototype.trim = function ()
-{
- var str = this.replace(/^\s+/g, '');
- str = str.replace(/\s+$/g, '');
-
- return str;
-}
-
String.prototype.replaceAll = function (sFind, sReplace)
{
thisString = this.valueOf();
@@ -32,7 +24,7 @@
function QubitDialog(table, options, $)
{
this.table = document.getElementById(table);
- this.form = $(this.table).parents('form').get(0); // parent form
+ this.form = $(this.table).parents('form').get(0); // Parent form
this.instances = 0; // Counter
this.label = $('caption', this.table).remove().text();
this.fields = [];
@@ -104,12 +96,12 @@
return false; // Prevent default action: "go to top of page"
});
- // Replace dialog table with "add" link and move into dialog wrapper
+ // Replace dialog table with "Add" link and move into dialog wrapper
$(this.table)
.replaceWith(addLink)
.appendTo(yuiDialogWrapper.find('form'));
- // Tooltips (TODO: move to js/description.js?)
+ // Tooltips (TODO Move to js/description.js?)
yuiDialogWrapper.find('.description').addClass('description-right').hide();
yuiDialogWrapper.find('td:has(.description)')
.focusin(function()
@@ -122,7 +114,7 @@
yuiDialogWrapper.find('.description').hide();
});
- // prepend yuiDialogWrapper to document body
+ // Prepend yuiDialogWrapper to document body
$('body').prepend(yuiDialogWrapper);
// Submit dialog data
@@ -138,16 +130,16 @@
this.yuiDialog = new YAHOO.widget.Dialog(this.table.id,
{
- width: "480px",
- zIndex: "100",
+ width: '480px',
+ zIndex: '100',
fixedcenter: true,
draggable: true,
visible: false,
modal: true,
constraintoviewport: true,
postmethod: 'none',
- buttons: [ { text: "Submit", handler: handleYuiSubmit, isDefault: true },
- { text: "Cancel", handler: handleYuiCancel } ],
+ buttons: [ { text: 'Submit', handler: handleYuiSubmit, isDefault: true },
+ { text: 'Cancel', handler: handleYuiCancel } ],
effect: { effect: YAHOO.widget.ContainerEffect.FADE, duration: 0.25 }
} );
@@ -161,12 +153,12 @@
scope: this.yuiDialog,
correctScope: true });
- this.yuiDialog.cfg.queueProperty("keylisteners", keyListener_Enter.enable());
- this.yuiDialog.cfg.queueProperty("keylisteners", keyListener_Esc.enable());
+ this.yuiDialog.cfg.queueProperty('keylisteners', keyListener_Enter.enable());
+ this.yuiDialog.cfg.queueProperty('keylisteners', keyListener_Esc.enable());
this.yuiDialog.render();
- // Remove all showEvent listeners to prevent default 'focusFirst' behaviour
+ // Remove all showEvent listeners to prevent default "focusFirst" behaviour
this.yuiDialog.showEvent.unsubscribeAll();
// Append hidden fields to form on submit
@@ -175,9 +167,9 @@
event.preventDefault();
thisDialog.appendHiddenFields();
- // Apply selector to <iframe/> contents, update value
- // of selected element with value of the autocomplete
- // <input/>, and submit selected element's form
+ // Apply selector to <iframe/> contents, update value of selected element
+ // with value of the autocomplete <input/>, and submit selected element's
+ // form
var iframe;
while (iframe = thisDialog.iframes.shift())
{
@@ -218,7 +210,7 @@
{
if ($(this.fields[fname]).next().hasClass('form-autocomplete'))
{
- // Auto-complete text
+ // Autocomplete text
return $(this.fields[fname]).next().val();
}
else if ('select-one' == this.fields[fname].type || 'select-multi' ==
this.fields[fname].type)
@@ -261,8 +253,8 @@
{
if (undefined == arguments[0])
{
- // If no 'id' passed as argument then create unique id and skip the
- // data load
+ // If no "id" passed as argument then create unique id and skip the data
+ // load
this.id = 'new' + this.instances++;
}
else
@@ -305,7 +297,7 @@
}
else
{
- // TODO: Ajax call to get relation data from db
+ // TODO Ajax call to get relation data from database
var dataSource = new YAHOO.util.XHRDataSource(id);
dataSource.responseType = YAHOO.util.DataSourceBase.TYPE_JSON;
dataSource.parseJSONData = function (request, response)
@@ -363,7 +355,7 @@
{
var hiddenInput = this.fields[fieldname];
- // First check if a 'Display' value is include in "thisData"
+ // First check if a "Display" value is include in "thisData"
var displayField = fieldname.substr(0, fieldname.length-1)+'Display]';
if (undefined != thisData[displayField])
{
@@ -499,7 +491,7 @@
}
}
- // Clear auto-complete fields
+ // Clear autocomplete fields
$('input.form-autocomplete', $(this.table)).val('');
return this;
@@ -514,7 +506,8 @@
var tr = $('#' + this.options.displayTable).find('tr[id="' + thisId +
'"]');
- // Wrap td contents in div so the row hides nicely then hide and remove row
+ // Wrap <td/> contents in <div/> so the row hides nicely then hide and
+ // remove row
tr.children('td')
.wrapInner('<div></div>')
.children('div').hide('normal', function () {
@@ -600,7 +593,7 @@
var i = 0;
if (null != this.fieldPrefix)
{
- // Append 's' to old prefix to indicate multiple nature
+ // Append "s" to old prefix to indicate multiple nature
var outputPrefix = this.fieldPrefix + 's';
}
else
@@ -661,5 +654,4 @@
$(this.form).append('<input type="hidden" name="deleteRelations[' +
this.deletes[k] + ']" value="delete" />');
}
}
-
}
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.