BUGFIX: convert ImageFormAction form prototype syntax to jQuery syntax

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@94304 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2009-12-03 00:56:06 +00:00 committed by Sam Minnee
parent 2d23990869
commit f8f446fea4
2 changed files with 16 additions and 18 deletions

View File

@ -22,8 +22,8 @@ class ImageFormAction extends FormAction {
parent::__construct($action, $title, $form);
}
function Field() {
Requirements::javascript(THIRDPARTY_DIR . '/prototype.js');
Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/livequery/jquery.livequery.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/ImageFormAction.js');
$classClause = '';

View File

@ -1,20 +1,18 @@
Behaviour.register({
'input.rollover' : {
initialize: function() {
var srcParts = this.src.match( /(.*)\.([a-zA-Z]+)$/ );
(function($) {
$(document).ready(function() {
$("input.rollover").livequery(function(){
var srcParts = jQuery(this).attr('src').match( /(.*)\.([a-zA-Z]+)$/ );
var fileName = srcParts[1];
var extension = srcParts[2];
this.overSrc = fileName + '_over.' + extension;
this.outSrc = this.src;
},
this.outSrc = jQuery(this).attr('src');
});
$("input.rollover").livequery('mouseover', function(){
jQuery(this).attr('src', this.overSrc);
});
onmouseover: function() {
this.src = this.overSrc;
},
onmouseout: function() {
this.src = this.outSrc;
}
}
});
$("input.rollover").livequery('mouseout', function(){
jQuery(this).attr('src', this.outSrc);
});
});
})(jQuery);