Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add European mode
For Aloodo, European mode works the same as regular
mode.

This is to help test browser extensions that look
for sites that treat European and non-European users
differently.

Extensions can test if the page they're on has Aloodo
and European mode is available, with:

```
window.aloodo && typeof(aloodo.setEuropeanMode)
```

Example (work in progress):
  https://github.com/dmarti/trans-europa-express
  • Loading branch information
dmarti committed May 6, 2018
1 parent 1543200 commit 859f265
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions track.js
Expand Up @@ -68,19 +68,29 @@
console.log('[Aloodo]['+method+'] '+message);
};

Aloodo.prototype.setOption = function(options, value) {
if(value !== undefined) {
var key = options;
options = {};
options[key] = value;
}
for(var option in options) {
this._options[option] = options[option];
this._dlog('setOption', 'The option "'+option+'" was assigned to "'+options[option]+'"');
Aloodo.prototype.getOption = function(key) {
if (this._options.hasOwnProperty(key)) {
return this._options[key];
} else {
return undefined;
}
};

Aloodo.prototype.setOption = function(key, value) {
this._options[key] = value;
this._dlog('setOption', 'The option "' + key + '" was assigned the value "'+this._options[key]+'"');
return this;
};

Aloodo.prototype.setEuropeanMode = function(value) {
this._dlog('Setting European Mode to: ' + value);
return this.setOption('EuropeanMode', value);
};

Aloodo.prototype.getEuropeanMode = function(value) {
return this.getOption('EuropeanMode');
};

Aloodo.prototype._addIFrame = function() {
function postMsg() {
window.postMessage('Aloodo iframe loaded', '*');
Expand Down

0 comments on commit 859f265

Please sign in to comment.