The Website I want to write an Userscript for has something like that:
p.Stream = p.Class.extend({
.
.
.
_processResponse: function(data) {
if (!data.items || !data.items.length) {
return null;
}
this.reached.start = data.atStart || this.reached.start;
this.reached.end = data.atEnd || this.reached.end;
var oldestId, newestId;
if (this.options.promoted) {
data.items.sort(p.Stream.sortByPromoted);
oldestId = data.items[data.items.length - 1].promoted;
newestId = data.items[0].promoted;
} else {
data.items.sort(p.Stream.sortById);
oldestId = data.items[data.items.length - 1].id;
newestId = data.items[0].id;
}
var position = (oldestId < this._oldestId) ? p.Stream.POSITION.APPEND : p.Stream.POSITION.PREPEND;
this._oldestId = Math.min(this._oldestId, oldestId);
this._newestId = Math.max(this._newestId, newestId);
var prev = null;
var itemVotes = p.user.voteCache.votes.items;
for (var i = 0; i < data.items.length; i++) {
var item = data.items[i];
item.thumb = CONFIG.PATH.THUMBS + item.thumb;
item.image = CONFIG.PATH.IMAGES + item.id;
item.fullsize = item.fullsize ? CONFIG.PATH.FULLSIZE + item.fullsize : null;
item.vote = itemVotes[item.id] || 0;
this.items[item.id] = item;
}
return position;
}
});
I want to manipulate the _processResponse such that item.image points to another Source. Is this possible with Userscripts? I tried overriding the function like stated on some websites but that does not work like expected. I just want to override this function, nothing other than that.
ifstatement