Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentWillMount() {
var isModal = (network.getSearchParam('modal') ? true : false);
var initApp = ()=>{
this.login()
this.bookmark()
}
if ((__APPBUILD__)||(!isModal)) {
extensionHelpers.getSetting("typeSelected")
.then((alreadySelected)=>{
console.log(alreadySelected)
if (!alreadySelected)
return window.location.hash = '#/type';
initApp();
})
}
else
constructor(props) {
super(props);
this.handleBookmarkChange = this.handleBookmarkChange.bind(this);
this.goTo = this.goTo.bind(this);
this.buttonCollectionSelect = this.buttonCollectionSelect.bind(this);
this.state = Object.assign({
forceShowCollections: (network.getSearchParam('modal') ? true : false),
showCollections: false,
already: (props.location.query.already ? true : false),
anim: (props.location.query.anim ? props.location.query.anim : ""),
},this.prepareBookmark());
}
bookmark() {
bookmarkStore.onLoadURL(network.getSearchParam('saveurl'))
.then((b)=>{
this.bookmarkId = b._id;
this.bookmarkAlready = b.already;
this.isBookmarkLoaded = true;
this.onSuccess();
})
.catch((e)=>{
this.bookmarkError = e.toString();
this.isBookmarkLoaded=true;
this.onFail();
})
}
componentWillMount() {
var elem = document.getElementById("app");
var classNames = [];
//is retina display?
if (typeof window !== "undefined")
if (window.devicePixelRatio && devicePixelRatio >= 2)
if (typeof document !== 'undefined')
classNames.push('retina');
//Is modal mode
isModal = (network.getSearchParam('modal') ? true : false);
if (isModal)
classNames.push('is-modal');
classNames = classNames.concat(strings.getCurrentBrowser());
classNames.forEach((c)=>{
elem.classList.add(c);
})
//On blur close if is modal
if (!__DEV__)
window.addEventListener('blur', ()=>window.close());
if (isModal){
window.addEventListener('keydown', (e)=>{
if (!e.defaultPrevented)