[Jifty-commit] r4876 - in jifty/branches/jquery: lib/Jifty
share/web/static/js
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Jan 18 04:14:34 EST 2008
Author: gugod
Date: Fri Jan 18 04:14:34 2008
New Revision: 4876
Modified:
jifty/branches/jquery/lib/Jifty/Web.pm
jifty/branches/jquery/share/web/static/js/iautocompleter.js
jifty/branches/jquery/share/web/static/js/jifty.js
jifty/branches/jquery/share/web/static/js/jifty_interface.js
jifty/branches/jquery/share/web/static/js/jifty_utils.js
jifty/branches/jquery/share/web/static/js/key_bindings.js
jifty/branches/jquery/t/TestApp-JiftyJS/etc/config.yml
Log:
First attempt to completly remove prototyp-ism in all files.
The /act/play action in TestApp-JiftyJS can works properly. Also
have to remove rico library. May need to search other alternatives
or we can leave it for application developers.
Modified: jifty/branches/jquery/lib/Jifty/Web.pm
==============================================================================
--- jifty/branches/jquery/lib/Jifty/Web.pm (original)
+++ jifty/branches/jquery/lib/Jifty/Web.pm Fri Jan 18 04:14:34 2008
@@ -38,16 +38,12 @@
jsan/Upgrade/Array/push.js
jsan/DOM/Events.js
json.js
- prototype.js
jquery-1.2.1.js
iutil.js
iautocompleter.js
jifty_interface.js
jquery_noconflict.js
behaviour.js
- scriptaculous/builder.js
- scriptaculous/effects.js
- scriptaculous/controls.js
formatDate.js
template_declare.js
loc.js
@@ -62,7 +58,6 @@
key_bindings.js
context_menu.js
bps_util.js
- rico.js
yui/yahoo.js
yui/dom.js
yui/event.js
Modified: jifty/branches/jquery/share/web/static/js/iautocompleter.js
==============================================================================
--- jifty/branches/jquery/share/web/static/js/iautocompleter.js (original)
+++ jifty/branches/jquery/share/web/static/js/iautocompleter.js Fri Jan 18 04:14:34 2008
@@ -300,7 +300,7 @@
{
window.clearTimeout(jQuery.iAuto.timer);
var subject = jQuery.iAuto.getFieldValues(this);
-
+
var pressedKey = e.charCode || e.keyCode || -1;
if (/13|27|35|36|38|40|9/.test(pressedKey) && jQuery.iAuto.items) {
if (window.event) {
Modified: jifty/branches/jquery/share/web/static/js/jifty.js
==============================================================================
--- jifty/branches/jquery/share/web/static/js/jifty.js (original)
+++ jifty/branches/jquery/share/web/static/js/jifty.js Fri Jan 18 04:14:34 2008
@@ -162,7 +162,7 @@
fields: function() {
if(!this.cached_fields) {
var elements = new Array;
- var possible = Form.getElements(this.form);
+ var possible = jQuery(":input", this.form).get();
// Also pull from extra query parameters
for (var i = 0; i < this.extras.length; i++)
possible.push(this.extras[i]);
@@ -340,7 +340,7 @@
disable_input_fields: function(disabled_elements) {
var disable = function() {
- var elt = arguments[0];
+ var elt = this;
// Disabling hidden elements seems to make IE sad for some reason
if(elt.type != 'hidden') {
// Triggers https://bugzilla.mozilla.org/show_bug.cgi?id=236791
@@ -349,14 +349,14 @@
disabled_elements.push(elt);
}
};
- this.fields().each(disable);
- this.buttons().each(disable);
+ jQuery.each(this.fields(), disable);
+ jQuery.each(this.buttons(), disable);
},
enable_input_fields: function() {
- var enable = function() { arguments[0].disabled = false; };
- this.fields().each( enable );
- this.buttons().each( enable );
+ var enable = function() { this.disabled = false; };
+ jQuery.each(this.fields(), disable);
+ jQuery.each(this.buttons(), disable);
},
@@ -502,6 +502,8 @@
};
/* Forms */
+Form = {};
+
jQuery.extend(Form, {
// Return an Array of Actions that are in this form
getActions: function (element) {
@@ -527,6 +529,8 @@
var current_actions = {};
+Form.Element = {};
+
/* Fields */
jQuery.extend(Form.Element, {
// Get the moniker for this form element
@@ -582,6 +586,11 @@
}
},
+ getValue: function(element) {
+ element = Jifty.$(element);
+ return jQuery(element).val();
+ },
+
// Validates the action this form element is part of
validate: function (element) {
if ( !jQuery(element).is('.validation_disabled') ) {
@@ -991,15 +1000,10 @@
Top: 'prepend'
})[ f['mode'] ];
- jQuery(element)[method]( textContent.stripScripts() );
+ jQuery(element)[method]( textContent );
} else {
- jQuery(element).html( textContent.stripScripts() );
+ jQuery(element).html( textContent );
}
- // We need to give the browser some "settle" time before
- // we eval scripts in the body
- YAHOO.util.Event.onAvailable(element.id, function() {
- (function() { this.evalScripts() }).bind(textContent)();
- });
Behaviour.apply(element);
}
}
@@ -1222,7 +1226,14 @@
response_fragment = response_fragment.nextSibling) {
var exp_id = response_fragment.getAttribute("id");
- var f = expected_fragments.find(function(f) { return exp_id == f['region'] });
+
+ var f;
+ jQuery.each(expected_fragments, function() {
+ if (exp_id == this['region']) {
+ f = this;
+ return false;
+ }
+ });
if (!f)
continue;
@@ -1232,7 +1243,10 @@
extract_cacheable(response_fragment, f);
}
- update_from_cache.each(function(x) { x() });
+ jQuery.each(update_from_cache, function() {
+ this();
+ });
+ // update_from_cache.each(function(x) { x() });
walk_node(response,
{ result: function(result) {
@@ -1394,7 +1408,7 @@
jQuery(this.field).Autocomplete({
source: this.url,
- minchars: 0,
+ minchars: -1,
delay: 100,
helperClass: 'autocomplete',
selectClass: 'selected'
@@ -1460,7 +1474,6 @@
self.onBlur();
});
-
this.onBlur();
var form = Form.Element.getForm(element);
Modified: jifty/branches/jquery/share/web/static/js/jifty_interface.js
==============================================================================
--- jifty/branches/jquery/share/web/static/js/jifty_interface.js (original)
+++ jifty/branches/jquery/share/web/static/js/jifty_interface.js Fri Jan 18 04:14:34 2008
@@ -26,7 +26,9 @@
subject.autoCFG.lastSuggestion.each(
function(nr) {
- toWrite += '<li rel="' + jQuery(this).text() + '" dir="' + nr + '" style="cursor: default;">' + jQuery(this).text() + '</li>';
+ console.log("[" + jQuery(this).text() + "]");
+ var v = jQuery(this).text();
+ toWrite += '<li rel="' + v + '" dir="' + nr + '" style="cursor: default;">' + v + '</li>';
}
);
@@ -39,7 +41,7 @@
subjectValue.item.length != valueToAdd.length ? (subjectValue.pre.length + valueToAdd.length) : valueToAdd.length
);
}
-
+
if (size > 0) {
jQuery.iAuto.writeItems(subject, toWrite);
} else {
Modified: jifty/branches/jquery/share/web/static/js/jifty_utils.js
==============================================================================
--- jifty/branches/jquery/share/web/static/js/jifty_utils.js (original)
+++ jifty/branches/jquery/share/web/static/js/jifty_utils.js Fri Jan 18 04:14:34 2008
@@ -137,6 +137,10 @@
if ( diff > 0 )
Jifty.SmoothScroll.scrollTo( scrollTop + diff );
+ },
+
+ stripScripts: function(str) {
+ return str.replace(/<script(.|\s)*?\/script>/g, "");
}
};
Modified: jifty/branches/jquery/share/web/static/js/key_bindings.js
==============================================================================
--- jifty/branches/jquery/share/web/static/js/key_bindings.js (original)
+++ jifty/branches/jquery/share/web/static/js/key_bindings.js Fri Jan 18 04:14:34 2008
@@ -74,7 +74,7 @@
writeLegend: function(e) {
if ( !document.createElement
|| !document.createTextNode
- || Element.hasClassName(e, 'keybindings-written') )
+ || jQuery(e).is('.keybindings-written') )
return;
@@ -109,7 +109,7 @@
e.appendChild( label );
e.appendChild( dl );
- Element.addClassName(e, 'keybindings-written');
+ jQuery(e).addClass('keybindings-written');
/* since we wrote the legend, now obey it */
Jifty.KeyBindings.activate();
Modified: jifty/branches/jquery/t/TestApp-JiftyJS/etc/config.yml
==============================================================================
--- jifty/branches/jquery/t/TestApp-JiftyJS/etc/config.yml (original)
+++ jifty/branches/jquery/t/TestApp-JiftyJS/etc/config.yml Fri Jan 18 04:14:34 2008
@@ -4,7 +4,7 @@
ApplicationClass: TestApp::JiftyJS
ApplicationName: TestApp::JiftyJS
ApplicationUUID: F43CA57E-A4BE-11DC-A07C-465A83BE23AB
- ConfigFileVersion: 2
+ ConfigFileVersion: 3
Database:
CheckSchema: 1
Database: testapp_jiftyjs
More information about the Jifty-commit
mailing list