Skip to content

Commit

Permalink
update readme version 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fxnoob committed Mar 13, 2019
1 parent a0527c3 commit d81ea30
Show file tree
Hide file tree
Showing 30 changed files with 79 additions and 65 deletions.
Empty file modified .babelrc
100644 → 100755
Empty file.
Empty file modified .env
100644 → 100755
Empty file.
Empty file modified .gitattributes
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified _config.yml
100644 → 100755
Empty file.
Empty file modified package-lock.json
100644 → 100755
Empty file.
Empty file modified package.json
100644 → 100755
Empty file.
Empty file modified popup-page/App.jsx
100644 → 100755
Empty file.
Empty file modified popup-page/components/button.jsx
100644 → 100755
Empty file.
Empty file modified popup-page/components/header.jsx
100644 → 100755
Empty file.
121 changes: 60 additions & 61 deletions popup-page/components/home.jsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -45,71 +45,30 @@ export class Home extends React.Component {
closeAllParticlebutton: false,
restoreAllParticlebutton: false
};
handleIncludeUrlChange() {
console.log("this.state.checkBox", this.state.checkBox);
componentDidMount() {
//check if current tab is in hidden mode if yes then get settings
urlUtilController.getCurrentOpenedTabHostName()
.then((domain)=>{
console.log(domain);
if(domain!== undefined)
return dBController.get(domain);
throw new Error("undefined error");
})
.then((res)=>{
if(this.state.checkBox=== false) {
console.log("checkbox not checked" , this.state.checkBox);
let putData = {};
putData[res] = "getCurrentOpenedTabHostName";
dBController.set(putData).then((resss)=>{
console.log("" , resss);
const checkBoxVal = this.state.checkBox;
let checkBoxLabel = (checkBoxVal===false)?"This Domain is in Hidden mode":"Select this domain to hide from history.";
this.setState({checkBox: !this.state.checkBox , checkBoxLabelValue: checkBoxLabel});
}).catch((ee)=>{
});
}
else {
dBController.remove(res).then((res_str)=>{
console.log("remove",res);
this.setState({checkBox: false,checkBoxLabelValue: "Select this domain to hide from history."});
})
}
console.log("getCurrentOpenedTabHostName",res);
const key = Object.keys(res);
return (key.length > 0) ? 1 : 0;
})
.then((res)=>{
console.log(res);
if(res===1)
this.setState({checkBox: true, checkBoxLabelValue: "This Domain is in Hidden mode"});
else
this.setState({checkBox: false, checkBoxLabelValue: "Select this domain to hide from history."});
})
.catch((e)=>{
alert(e);
this.setState({checkBox: false});
console.log(e);
});
if(this.state.checkBox === true) {
this.setState({showCloseAlltab:true});
chrome.browserAction.setBadgeText({text: '♥'});
}
else {
/*
* check if any other incognito tab is opened
*/
chrome.browserAction.setBadgeText({text: ''});
}
}
constructor(props){
super(props);
this.handleCloseAll = this.handleCloseAll.bind(this);
this.handleRestoreAll = this.handleRestoreAll.bind(this);
this.handleIncludeUrlChange = this.handleIncludeUrlChange.bind(this);
}
componentDidMount() {
//check if current tab is in hidden mode if yes then get settings
urlUtilController.getCurrentOpenedTabHostName()
.then((domain)=>{
if(domain!== undefined)
return dBController.get(domain);
})
.then((res)=>{
console.log("getCurrentOpenedTabHostName",res);
const key = Object.keys(res);
return (key.length > 0) ? 1 : 0;
})
.then((res)=>{
console.log(res);
if(res===1)
this.setState({checkBox: true, checkBoxLabelValue: "This Domain is in Hidden mode"});
else
this.setState({checkBox: false, checkBoxLabelValue: "Select this domain to hide from history."});
}).catch((e)=>{
alert(e);
});
//check if there any closed_tabs session is in the storage
dBController.get("restore_tabs_url_list").then((dbres)=>{
if(dbres.restore_tabs_url_list.length>0)
Expand All @@ -132,6 +91,42 @@ export class Home extends React.Component {
console.log("checkIfIncognitoTabIsOpened",e);
});
}
constructor(props){
super(props);
this.handleCloseAll = this.handleCloseAll.bind(this);
this.handleRestoreAll = this.handleRestoreAll.bind(this);
this.handleIncludeUrlChange = this.handleIncludeUrlChange.bind(this);
}
handleIncludeUrlChange() {
urlUtilController.getCurrentOpenedTabHostName()
.then((res)=>{
if (this.state.checkBox === false) {
/** when check box is selected */
let putData = {};
putData[res] = res;
dBController.set(putData).then((resss)=>{
this.setState({checkBox: !this.state.checkBox , checkBoxLabelValue: "This Domain is in Hidden mode.",showCloseAlltab: true});
chrome.browserAction.setBadgeText({text: '♥'});
urlUtilController.getCurrentOpenedTabUrl()
.then(url=>{
urlUtilController.removeUrlFromHistory(url).then((res_str)=>{}).catch((e)=>{});
})
.catch(e=> {
console.log(e);
});
}).catch((ee)=>{});
} else {
/** when check box is unchecked */
this.setState({checkBox: !this.state.checkBox , checkBoxLabelValue: "Select this domain to hide from history."});
chrome.browserAction.setBadgeText({text: ''});
}
})
.catch(e=> {
/** TABS which are not accessed from chrome extension eg. blank tab , chrome store webpage etc. */
this.setState({checkBoxLabelValue: "This url can't be taken in Incognito mode"});
})
}

handleCloseAll(){
this.setState({closeAllParticlebutton: true,restoreAllParticlebutton: false});
urlUtilController.closeAllCurrentBlockedUrlTabs()
Expand Down Expand Up @@ -204,8 +199,12 @@ export class Home extends React.Component {
</FormGroup>
</Typography>
</Paper>}
<Divider variant="middle" />
<div>
Creator @<a href="https://github.com/fxnoob/" target="_blank">fxnoob</a> made with ♥ and this <a href="https://github.com/fxnoob/chrome-extension-boilerplate" target="_blank">chrome extension boilerplate</a> at <a href="https://github.com/nosemantic/" target="_blank">nosemantic</a>
</div>
</div>
);
}
}
export default withStyles(styles)(Home);
export default withStyles(styles)(Home);
Empty file modified popup-page/components/index.jsx
100644 → 100755
Empty file.
Empty file modified popup-page/components/particles.jsx
100644 → 100755
Empty file.
Empty file modified popup-page/popup.html
100644 → 100755
Empty file.
Empty file modified src/app/_locales/en/messages.json
100644 → 100755
Empty file.
Empty file modified src/app/images/favicon.ico
100644 → 100755
Empty file.
Empty file modified src/app/images/icon-128.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified src/app/images/icon-16.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified src/app/images/icon-32.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified src/app/manifest.json
100644 → 100755
Empty file.
Empty file modified src/app/popup.html
100644 → 100755
Empty file.
Empty file modified src/app/styles/main.css
100644 → 100755
Empty file.
Empty file modified src/background.js
100644 → 100755
Empty file.
Empty file modified src/background.test.js
100644 → 100755
Empty file.
Empty file modified src/data/websites.json
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions src/utils/db.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class Db {
set(params) {
return new Promise((resolve, reject) => {
try {
chrome.storage.sync.set(params, function(){
chrome.storage.sync.set(params, ()=>{
resolve(params);
});
}
Expand All @@ -25,7 +25,7 @@ export default class Db {
get(params) {
return new Promise((resolve, reject) => {
try {
chrome.storage.sync.get(params, function(items){
chrome.storage.sync.get(params, (items)=>{
if(items === undefined)
reject("Error");
else
Expand Down Expand Up @@ -53,4 +53,4 @@ export default class Db {
}
})
}
}
}
17 changes: 16 additions & 1 deletion src/utils/urlutil.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,21 @@ export default class urlUtil {
}
});
}
getCurrentOpenedTabUrl() {
return new Promise((resolve, reject) => {
try {
chrome.tabs.query({active: true, currentWindow: true }, (tabs)=>{
if(tabs[0].url === undefined || tabs[0].url === null)
reject("Null or Undefined url");
else
resolve(tabs[0].url);
});
}
catch (e) {
reject(e);
}
});
}
/*
* set badge on action icon
* */
Expand All @@ -214,4 +229,4 @@ export default class urlUtil {
});
});
}
};
};
Empty file modified src/utils/urlutil.test.js
100644 → 100755
Empty file.
Empty file modified webpack.config.js
100644 → 100755
Empty file.

0 comments on commit d81ea30

Please sign in to comment.