Telegram Web, preconfigured for usage in I2P.
http://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
11 years ago
|
var fs = require('fs');
|
||
|
|
||
|
|
||
|
var PhantomJSBrowser = function(baseBrowserDecorator, config, args) {
|
||
|
baseBrowserDecorator(this);
|
||
|
|
||
|
var options = args && args.options || config && config.options || {};
|
||
|
var flags = args && args.flags || config && config.flags || [];
|
||
|
|
||
|
this._start = function(url) {
|
||
|
// create the js file that will open karma
|
||
|
var captureFile = this._tempDir + '/capture.js';
|
||
|
var optionsCode = Object.keys(options).map(function (key) {
|
||
|
if (key !== 'settings') { // settings cannot be overriden, it should be extended!
|
||
|
return 'page.' + key + ' = ' + JSON.stringify(options[key]) + ';';
|
||
|
}
|
||
|
});
|
||
|
|
||
|
if (options.settings) {
|
||
|
optionsCode = optionsCode.concat(Object.keys(options.settings).map(function (key) {
|
||
|
return 'page.settings.' + key + ' = ' + JSON.stringify(options.settings[key]) + ';';
|
||
|
}));
|
||
|
}
|
||
|
|
||
|
var captureCode = 'var page = require("webpage").create();\n' +
|
||
|
optionsCode.join('\n') + '\npage.open("' + url + '");\n';
|
||
|
fs.writeFileSync(captureFile, captureCode);
|
||
|
|
||
|
// and start phantomjs
|
||
|
this._execCommand(this._getCommand(), flags.concat(captureFile));
|
||
|
};
|
||
|
};
|
||
|
|
||
|
PhantomJSBrowser.prototype = {
|
||
|
name: 'PhantomJS',
|
||
|
|
||
|
DEFAULT_CMD: {
|
||
|
linux: require('phantomjs').path,
|
||
|
darwin: require('phantomjs').path,
|
||
|
win32: require('phantomjs').path
|
||
|
},
|
||
|
ENV_CMD: 'PHANTOMJS_BIN'
|
||
|
};
|
||
|
|
||
|
PhantomJSBrowser.$inject = ['baseBrowserDecorator', 'config.phantomjsLauncher', 'args'];
|
||
|
|
||
|
|
||
|
// PUBLISH DI MODULE
|
||
|
module.exports = {
|
||
|
'launcher:PhantomJS': ['type', PhantomJSBrowser]
|
||
|
};
|