Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
py7hon committed Feb 11, 2019
0 parents commit 596aef8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
34 changes: 34 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"manifest_version": 2,

"name": "open with nhentai",
"description": "open nhentai from code",
"version": "1.0",

"permissions": [
"activeTab",
"https://*.instagram.com/*",
"https://instagram.com/*",
"https://*.twitter.com/*",
"https://twitter.com/*",
"https://*.facebook.com/*",
"https://facebook.com/*",
"https://*.reddit.com/*",
"https://reddit.com/*",
"contextMenus",
"tabs"
],
"background": {
"scripts": [
"open-with-nhentai.js"
]
},
"web_accessible_resources": [
"open-with-nhentai.js"
],
"icons": {
"16": "nh.png",
"48": "nh.png",
"128": "nh.png"
}
}
Binary file added nh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions open-with-nhentai.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(function() {
chrome.contextMenus.create(
{
title: "Open With nHentai",
contexts: [
"selection"
],
onclick: function (event) {
chrome.windows.getAll({}, function (windowList) {
var incognitoWindow = null;
for (var i = windowList.length - 1; i >= 0; i--) {
if(windowList[i].incognito) {
incognitoWindow = windowList[i];
i = -1;
}
}

if(incognitoWindow === null) {
chrome.windows.create({incognito: true, state: 'maximized', focused: true, url: "https://nhent.ai/g/" + event.selectionText});
} else {
chrome.tabs.create({windowId: incognitoWindow.id, url: "https://nhent.ai/g/" + event.selectionText, active: true});
}
});
},
visible: true
}
);
})();

0 comments on commit 596aef8

Please sign in to comment.