Commit 86809e30 authored by Romain Courteaud's avatar Romain Courteaud

Drop useless gadget parameter to the selector.

parent 91c789e9
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
var gk = rJS(window); var gk = rJS(window);
gk.declareMethod('setContent', function (value) { gk.declareMethod('setContent', function (value) {
rJS(this).editor.getSession().setValue(value); this.editor.getSession().setValue(value);
}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
return rJS(this).editor.getSession().getValue(); return this.editor.getSession().getValue();
}); });
gk.ready(function (g) { gk.ready(function (g) {
......
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
var gk = rJS(window); var gk = rJS(window);
gk.declareMethod('setContent', function (value) { gk.declareMethod('setContent', function (value) {
rJS(this).element.getElementsByTagName('textarea')[0].value = this.element.getElementsByTagName('textarea')[0].value =
escape_text(value); escape_text(value);
}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
return rJS(this).element.getElementsByTagName('textarea')[0].value; return this.element.getElementsByTagName('textarea')[0].value;
}); });
}(window, rJS)); }(window, rJS));
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
var gk = rJS(window); var gk = rJS(window);
gk.declareMethod('configureIO', function (key) { gk.declareMethod('configureIO', function (key) {
rJS(this).jio = jIO.createJIO({ this.jio = jIO.createJIO({
"type": "local", "type": "local",
"username": "couscous", "username": "couscous",
"application_name": "renderjs" "application_name": "renderjs"
}); });
rJS(this).jio_key = key; this.jio_key = key;
}) })
.declareMethod('getIO', function () { .declareMethod('getIO', function () {
var gadget = rJS(this); var gadget = this;
return gadget.jio.getAttachment({ return gadget.jio.getAttachment({
"_id": gadget.jio_key, "_id": gadget.jio_key,
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
}) })
.declareMethod('setIO', function (value) { .declareMethod('setIO', function (value) {
var gadget = rJS(this); var gadget = this;
return gadget.jio.put({"_id": gadget.jio_key}) return gadget.jio.put({"_id": gadget.jio_key})
.then(function () { .then(function () {
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
}) })
.declareMethod('configureDataSourceCallback', function (that, callback) { .declareMethod('configureDataSourceCallback', function (that, callback) {
var g = rJS(this); var g = this;
$(g.element).find('a').unbind('click').click(function () { $(g.element).find('a').unbind('click').click(function () {
callback.apply(that).then(function (value) { callback.apply(that).then(function (value) {
g.setIO(value); g.setIO(value);
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
var gk = rJS(window); var gk = rJS(window);
gk.declareMethod('setContent', function (value) { gk.declareMethod('setContent', function (value) {
// return rJS(this).context.find('textarea').val(escape_text(value)); // return this.context.find('textarea').val(escape_text(value));
return $(rJS(this).element).find('#textarea-b').jqteVal(value); return $(this.element).find('#textarea-b').jqteVal(value);
}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
return $(rJS(this).element).find('#textarea-b').val(); return $(this.element).find('#textarea-b').val();
}); });
gk.ready(function (g) { gk.ready(function (g) {
......
...@@ -331,8 +331,6 @@ ...@@ -331,8 +331,6 @@
// window is the 'this' value when loading a javascript file // window is the 'this' value when loading a javascript file
// In this case, use the current loading gadget constructor // In this case, use the current loading gadget constructor
result = gadget_loading_klass; result = gadget_loading_klass;
} else if (selector instanceof RenderJSGadget) {
result = selector;
} }
if (result === undefined) { if (result === undefined) {
throw new Error("Unknown selector '" + selector + "'"); throw new Error("Unknown selector '" + selector + "'");
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
throw new Error("Manually triggered embedded error"); throw new Error("Manually triggered embedded error");
}) })
.declareMethod('triggerEvent', function (value) { .declareMethod('triggerEvent', function (value) {
return rJS(this).trigger('fooTrigger', 'barValue'); return this.trigger('fooTrigger', 'barValue');
}) })
.declareMethod('setContent', function (value) { .declareMethod('setContent', function (value) {
rJS(this).embedded_property = value; this.embedded_property = value;
}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
return rJS(this).embedded_property; return this.embedded_property;
}); });
}(window, rJS)); }(window, rJS));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment