mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
0ef452c524
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65351 467b73ca-7a2a-4603-9d3b-597d59a354a9
76 lines
2.5 KiB
JavaScript
76 lines
2.5 KiB
JavaScript
ImageEditor.Effects = {};
|
|
ImageEditor.Effects.Base = {
|
|
initialize: function(effectName) {
|
|
this.disabled = false;
|
|
this.perform = ImageEditor.Effects.Base.perform.bind(this);
|
|
this.setListener = ImageEditor.Effects.Base.setListener.bind(this);
|
|
this.enable = ImageEditor.Effects.Base.enable.bind(this);
|
|
this.disable = ImageEditor.Effects.Base.disable.bind(this);
|
|
this.callback = ImageEditor.Effects.Base.callback.bind(this);
|
|
this.effectName = effectName;
|
|
this.setListener();
|
|
},
|
|
|
|
perform: function() {
|
|
if(!this.disabled) {
|
|
ImageEditor.transformation.customRequest(this.effectName,this.callback,undefined,undefined,true);
|
|
}
|
|
},
|
|
|
|
callback: function() {
|
|
ImageEditor.history.addEffect($('image').src,this.effectName);
|
|
},
|
|
|
|
setListener: function(eventHandler) {
|
|
var effectName = this.effectName.substring(0,1).toUpperCase() + this.effectName.substring(1,this.effectName.length);
|
|
if($(effectName + 'Button')) {
|
|
Event.observe(effectName + 'Button','click',this.perform);
|
|
}
|
|
},
|
|
|
|
disable: function() {
|
|
this.disabled = true;
|
|
},
|
|
|
|
enable: function() {
|
|
this.disabled = false;
|
|
}
|
|
}
|
|
ImageEditor.Effects = {};
|
|
ImageEditor.Effects.Base = {
|
|
initialize: function(effectName) {
|
|
this.disabled = false;
|
|
this.perform = ImageEditor.Effects.Base.perform.bind(this);
|
|
this.setListener = ImageEditor.Effects.Base.setListener.bind(this);
|
|
this.enable = ImageEditor.Effects.Base.enable.bind(this);
|
|
this.disable = ImageEditor.Effects.Base.disable.bind(this);
|
|
this.callback = ImageEditor.Effects.Base.callback.bind(this);
|
|
this.effectName = effectName;
|
|
this.setListener();
|
|
},
|
|
|
|
perform: function() {
|
|
if(!this.disabled) {
|
|
ImageEditor.transformation.customRequest(this.effectName,this.callback,undefined,undefined,true);
|
|
}
|
|
},
|
|
|
|
callback: function() {
|
|
ImageEditor.history.addEffect($('image').src,this.effectName);
|
|
},
|
|
|
|
setListener: function(eventHandler) {
|
|
var effectName = this.effectName.substring(0,1).toUpperCase() + this.effectName.substring(1,this.effectName.length);
|
|
if($(effectName + 'Button')) {
|
|
Event.observe(effectName + 'Button','click',this.perform);
|
|
}
|
|
},
|
|
|
|
disable: function() {
|
|
this.disabled = true;
|
|
},
|
|
|
|
enable: function() {
|
|
this.disabled = false;
|
|
}
|
|
} |