use beefy ui
This commit is contained in:
parent
12c81a22e8
commit
32c5b414de
5 changed files with 10 additions and 62 deletions
|
@ -1,38 +1,9 @@
|
|||
import hash from 'string-hash';
|
||||
|
||||
const experiments = {
|
||||
'5YHCzn2CQTmBwWwTmZupBA': {
|
||||
id: '5YHCzn2CQTmBwWwTmZupBA',
|
||||
run: function(variant, state, emitter) {
|
||||
state.experiment = {
|
||||
xid: this.id,
|
||||
xvar: variant
|
||||
};
|
||||
// Beefy UI
|
||||
if (variant === 1) {
|
||||
state.config.uploadWindowStyle = 'upload-window upload-window-b';
|
||||
state.config.uploadButtonStyle = 'btn browse browse-b';
|
||||
} else {
|
||||
state.config.uploadWindowStyle = 'upload-window';
|
||||
state.config.uploadButtonStyle = 'btn browse';
|
||||
}
|
||||
emitter.emit('render');
|
||||
},
|
||||
eligible: function(state) {
|
||||
return this.luckyNumber(state) >= 0.5;
|
||||
},
|
||||
variant: function(state) {
|
||||
return this.luckyNumber(state) < 0.75 ? 0 : 1;
|
||||
},
|
||||
luckyNumber: function(state) {
|
||||
return luckyNumber(
|
||||
`${this.id}:${state.storage.get('testpilot_ga__cid')}`
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
const experiments = {};
|
||||
|
||||
//Returns a number between 0 and 1
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function luckyNumber(str) {
|
||||
return hash(str) / 0xffffffff;
|
||||
}
|
||||
|
|
|
@ -20,10 +20,6 @@ app.use((state, emitter) => {
|
|||
state.translate = locale.getTranslator();
|
||||
state.storage = storage;
|
||||
state.raven = Raven;
|
||||
state.config = {
|
||||
uploadWindowStyle: 'upload-window',
|
||||
uploadButtonStyle: 'browse btn'
|
||||
};
|
||||
emitter.on('DOMContentLoaded', async () => {
|
||||
if (
|
||||
/firefox/i.test(navigator.userAgent) &&
|
||||
|
|
|
@ -13,8 +13,7 @@ module.exports = function(state, emit) {
|
|||
'uploadPageLearnMore'
|
||||
)}</a>
|
||||
</div>
|
||||
<div class="${state.config
|
||||
.uploadWindowStyle}" ondragover=${dragover} ondragleave=${dragleave}>
|
||||
<div class="upload-window" ondragover=${dragover} ondragleave=${dragleave}>
|
||||
<div id="upload-img"><img src="${assets.get(
|
||||
'upload.svg'
|
||||
)}" title="${state.translate('uploadSvgAlt')}"/></div>
|
||||
|
@ -24,10 +23,9 @@ module.exports = function(state, emit) {
|
|||
)}</em></span>
|
||||
<form method="post" action="upload" enctype="multipart/form-data">
|
||||
<input id="file-upload" type="file" name="fileUploaded" onchange=${upload} onfocus=${onfocus} onblur=${onblur} />
|
||||
<label for="file-upload" id="browse" class="${state.config
|
||||
.uploadButtonStyle}" title="${state.translate(
|
||||
'uploadPageBrowseButton1'
|
||||
)}">${state.translate('uploadPageBrowseButton1')}</label>
|
||||
<label for="file-upload" id="browse" class="btn browse" title="${state.translate(
|
||||
'uploadPageBrowseButton1'
|
||||
)}">${state.translate('uploadPageBrowseButton1')}</label>
|
||||
</form>
|
||||
</div>
|
||||
${fileList(state, emit)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue