commit
a2213104f9
|
|
@ -1,6 +1,5 @@
|
||||||
'use strict';
|
// 'use strict';
|
||||||
|
chrome.runtime.onInstalled.addListener(function() {
|
||||||
chrome.runtime.onInstalled.addListener(function () {
|
|
||||||
// https://stackoverflow.com/questions/19377262/regex-for-youtube-url
|
// https://stackoverflow.com/questions/19377262/regex-for-youtube-url
|
||||||
chrome.contextMenus.create({
|
chrome.contextMenus.create({
|
||||||
id: 'metube',
|
id: 'metube',
|
||||||
|
|
@ -8,14 +7,102 @@ chrome.runtime.onInstalled.addListener(function () {
|
||||||
targetUrlPatterns: [
|
targetUrlPatterns: [
|
||||||
'https://www.youtube.com/*',
|
'https://www.youtube.com/*',
|
||||||
'https://m.youtube.com/*',
|
'https://m.youtube.com/*',
|
||||||
'https://youtu.be/*'
|
'https://youtu.be/*',
|
||||||
|
'https://xnxx.com/*',
|
||||||
|
'https://www.xnxx.com/*',
|
||||||
|
'http://www.alphaporno.com/*',
|
||||||
|
'http://beeg.com/*',
|
||||||
|
'https://beeg.com/*',
|
||||||
|
'https://beeg.porn/*',
|
||||||
|
'http://www.behindkink.com/*',
|
||||||
|
'http://www.porntrex.com/*',
|
||||||
|
'http://www.cracked.com/*',
|
||||||
|
'https://www.crackle.com/*',
|
||||||
|
'http://www.crunchyroll.fr/*',
|
||||||
|
'https://www.crunchyroll.com/*',
|
||||||
|
'https://xhamster.com/*',
|
||||||
|
'https://xvideos.com/*',
|
||||||
|
'https://redtube.com/*',
|
||||||
|
'https://pornhub.com/*',
|
||||||
|
'https://spankbang.com/*',
|
||||||
|
'https://youporn.com/*',
|
||||||
|
'https://incestflix.com/*',
|
||||||
|
'https://pornbimbo.com/*',
|
||||||
|
'https://rule43.com/*',
|
||||||
|
'https://freeuseporn.com/*',
|
||||||
|
'https://tubesafari.com/*',
|
||||||
|
'https://www.freeuseporn.org/*',
|
||||||
|
'https://incestflix.com/*',
|
||||||
|
'https://freeusex.com/*',
|
||||||
|
'https://www.xhamster.com/*',
|
||||||
|
'https://www.xvideos.com/*',
|
||||||
|
'https://www.redtube.com/*',
|
||||||
|
'https://www.pornhub.com/*',
|
||||||
|
'https://www.spankbang.com/*',
|
||||||
|
'https://www.youporn.com/*',
|
||||||
|
'https://www.incestflix.com/*',
|
||||||
|
'https://www.pornbimbo.com/*',
|
||||||
|
'https://www.rule43.com/*',
|
||||||
|
'https://www.freeuseporn.com/*',
|
||||||
|
'https://www.tubesafari.com/*',
|
||||||
|
'https://www.freeuseporn.org/*',
|
||||||
|
'https://www.incestflix.com/*',
|
||||||
|
'https://www.freeusex.com/*',
|
||||||
|
'http://www.crunchyroll.com/*',
|
||||||
|
'http://www.dailymail.co.uk/*',
|
||||||
|
'http://digg.com/*',
|
||||||
|
'https://www.ultimedia.com/*',
|
||||||
|
'https://www.digiteka.net/*',
|
||||||
|
'http://www.ultimedia.com/*',
|
||||||
|
'https://www.investigationdiscovery.com/*',
|
||||||
|
'https://go.discovery.com/*',
|
||||||
|
'https://www.sciencechannel.com/*',
|
||||||
|
'https://api.discovery.com/*',
|
||||||
|
'https://www.discovery.com/*',
|
||||||
|
'https://www.discoverygo.com/*',
|
||||||
|
'https://www.tlc.de/*',
|
||||||
|
'https://tlc.de/*',
|
||||||
|
'http://www.discoveryvr.com/*',
|
||||||
|
'http://video.disney.com/*',
|
||||||
|
'https://www.eporner.com/*',
|
||||||
|
'https://cdn.espn.go.com/*',
|
||||||
|
'https://espn.go.com/*',
|
||||||
|
'http://www.espnfc.us/*',
|
||||||
|
'http://www.espnfc.com/*',
|
||||||
|
'http://www.espn.com/*',
|
||||||
|
'http://api-app.espn.com/*',
|
||||||
|
'http://espn.go.com/*',
|
||||||
|
'https://m.facebook.com/*',
|
||||||
|
'https://developers.facebook.com/*',
|
||||||
|
'https://www.facebook.com/*',
|
||||||
|
'https://www.porntube.com/*',
|
||||||
|
'https://m.porntube.com/*',
|
||||||
|
'https://www.pornerbros.com/*',
|
||||||
|
'https://m.pornerbros.com/*',
|
||||||
|
'https://www.fox.com/*',
|
||||||
|
'http://www.eporner.com/*',
|
||||||
|
'http://4shared.com/*',
|
||||||
|
'http://instagram.com/*',
|
||||||
|
'http://facebook.com/*',
|
||||||
|
'http://m.facebook.com/*',
|
||||||
|
'http://www.facebook.com/*',
|
||||||
|
'http://Gov.sg/*',
|
||||||
|
'http://faz.net/*',
|
||||||
|
'http://dl.org/*',
|
||||||
|
'http://token.4tube.com/*',
|
||||||
|
'http://token.fux.com/*',
|
||||||
|
'http://tkn.porntube.com/*',
|
||||||
|
'http://token.pornerbros.com/*',
|
||||||
|
'http://Foxgay.com/*',
|
||||||
|
'http://foxgay.com/*'
|
||||||
|
|
||||||
],
|
],
|
||||||
contexts: ['link'],
|
contexts: ['link'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.contextMenus.onClicked.addListener(function (item, tab) {
|
chrome.contextMenus.onClicked.addListener(function(item, tab) {
|
||||||
chrome.storage.sync.get(['metube'], function (data) {
|
chrome.storage.sync.get(['metube'], function(data) {
|
||||||
if (data === undefined || !data.hasOwnProperty('metube') || data.metube === "") {
|
if (data === undefined || !data.hasOwnProperty('metube') || data.metube === "") {
|
||||||
openTab(chrome.runtime.getURL('options.html'), tab);
|
openTab(chrome.runtime.getURL('options.html'), tab);
|
||||||
return
|
return
|
||||||
|
|
@ -27,16 +114,19 @@ chrome.contextMenus.onClicked.addListener(function (item, tab) {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({"quality": "best", "url": item.linkUrl})
|
body: JSON.stringify({
|
||||||
|
"quality": "best",
|
||||||
|
"url": item.linkUrl
|
||||||
})
|
})
|
||||||
.then(function (res) {
|
})
|
||||||
|
.then(function(res) {
|
||||||
if (res.ok === true && res.status === 200) {
|
if (res.ok === true && res.status === 200) {
|
||||||
return res.json();
|
return res.json();
|
||||||
}
|
}
|
||||||
// todo fix it
|
// todo fix it
|
||||||
alert("error :: code " + res.status);
|
alert("error :: code " + res.status);
|
||||||
})
|
})
|
||||||
.then(function (result) {
|
.then(function(result) {
|
||||||
if (result.status === "ok") {
|
if (result.status === "ok") {
|
||||||
openTab(data.metube, tab);
|
openTab(data.metube, tab);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -44,14 +134,14 @@ chrome.contextMenus.onClicked.addListener(function (item, tab) {
|
||||||
alert("error :: " + json);
|
alert("error :: " + json);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function (res) {
|
.catch(function(res) {
|
||||||
alert("error :: " + res);
|
alert("error :: " + res);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.action.onClicked.addListener(function (tab) {
|
chrome.action.onClicked.addListener(function(tab) {
|
||||||
chrome.storage.sync.get(['metube'], function (data) {
|
chrome.storage.sync.get(['metube'], function(data) {
|
||||||
if (data === undefined || !data.hasOwnProperty('metube') || data.metube === "") {
|
if (data === undefined || !data.hasOwnProperty('metube') || data.metube === "") {
|
||||||
openTab(chrome.runtime.getURL('options.html'), tab);
|
openTab(chrome.runtime.getURL('options.html'), tab);
|
||||||
return
|
return
|
||||||
|
|
@ -62,12 +152,18 @@ chrome.action.onClicked.addListener(function (tab) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function openTab(url, currentTab) {
|
function openTab(url, currentTab) {
|
||||||
chrome.tabs.query({url: url + "/*"}, function (tabs) {
|
chrome.tabs.query({
|
||||||
|
url: url + "/*"
|
||||||
|
}, function(tabs) {
|
||||||
if (tabs.length !== 0) {
|
if (tabs.length !== 0) {
|
||||||
chrome.tabs.update(tabs[0].id, {'active': true}, () => {
|
chrome.tabs.update(tabs[0].id, {
|
||||||
});
|
'active': true
|
||||||
|
}, () => {});
|
||||||
} else {
|
} else {
|
||||||
chrome.tabs.create({url: url, index: currentTab.index + 1});
|
chrome.tabs.create({
|
||||||
|
url: url,
|
||||||
|
index: currentTab.index + 1
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue