Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
scoful committed Apr 12, 2020
1 parent 5c1a835 commit 6d1d19b
Show file tree
Hide file tree
Showing 9 changed files with 226 additions and 0 deletions.
Binary file added images/128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions js/jquery-2.2.2.min.js

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions js/nineone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
console.log("nineone is done!!");

// 也是contentScript,只在打开http://91porn.com/view_video.php?*的时候触发
document.addEventListener('DOMContentLoaded', function () {
injectCustomJs();
injectCustomJs2();
initCustomPanel();
});

// 向页面注入自定义JS
function injectCustomJs(jsPath) {
jsPath = jsPath || 'js/nineoneInject.js';
var temp = document.createElement('script');
temp.setAttribute('type', 'text/javascript');
temp.src = chrome.extension.getURL(jsPath);
temp.onload = function () {
console.log("nineoneInject.js on loaded");
};
document.body.appendChild(temp);
}

// 向页面注入自定义JS
function injectCustomJs2(jsPath) {
jsPath = jsPath || 'js/jquery-2.2.2.min.js';
var temp = document.createElement('script');
temp.setAttribute('type', 'text/javascript');
temp.src = chrome.extension.getURL(jsPath);
temp.onload = function () {
console.log("jquery-2.2.2.min.js on loaded");
};
document.body.appendChild(temp);
}

// 直接覆盖本来的html,即修改了本来的html结构,改成自己想要的
function initCustomPanel() {
if (document.getElementsByClassName("boxPart")[1]) {
let html = document.getElementsByClassName("boxPart")[1].innerHTML;
let child = `
<div class="floatmenu">
<div id="mySuperDownload" class="video-info-span">超级下载</div>
</div>
<br>
<div id="mySuperDownloadArea" style="display:none"></div>
`;
document.getElementsByClassName("boxPart")[1].innerHTML = html + child
}
}


23 changes: 23 additions & 0 deletions js/nineoneInject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
document.getElementById('mySuperDownload').addEventListener('click', function () {
$("#mySuperDownloadArea").toggle()
var url = "";
if ($('source')) {
if ($('source')[0]) {
url = $('source')[0].src;
}
}
let html = document.getElementById("mySuperDownloadArea").innerHTML
html = "";
let child = `
<div>
<sapn>视频地址:</span> <textarea cols="80" id="urlArea" readonly="readonly">${url}</textarea><a class = "btn btn-primary" onClick="copyUrl()">复制</a>
</div>
`
document.getElementById("mySuperDownloadArea").innerHTML = html + child;
});

function copyUrl() {
var Url2 = document.getElementById("urlArea");
Url2.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
}
59 changes: 59 additions & 0 deletions js/pornhub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
console.log("pornhub is done!!");

// 也是contentScript,只在打开https://*.pornhub.com/view_video.php?*和https://*.pornhubpremium.com/view_video.php?*的时候触发
document.addEventListener('DOMContentLoaded', function () {
injectCustomJs();
injectCustomJs2();
initCustomPanel();
});


// 向页面注入自定义JS
function injectCustomJs(jsPath) {
jsPath = jsPath || 'js/pornhubInject.js';
var temp = document.createElement('script');
temp.setAttribute('type', 'text/javascript');
temp.src = chrome.extension.getURL(jsPath);
temp.onload = function () {
console.log("pornhubInject.js on loaded");
};
document.body.appendChild(temp);
}

// 向页面注入自定义JS
function injectCustomJs2(jsPath) {
jsPath = jsPath || 'js/jquery-2.2.2.min.js';
var temp = document.createElement('script');
temp.setAttribute('type', 'text/javascript');
temp.src = chrome.extension.getURL(jsPath);
temp.onload = function () {
console.log("jquery-2.2.2.min.js on loaded");
};
document.body.appendChild(temp);
}

// 直接覆盖本来的html,即修改了本来的html结构,改成自己想要的
function initCustomPanel() {
if (document.getElementsByClassName("tab-menu-wrapper-row")[0]) {
let html = document.getElementsByClassName("tab-menu-wrapper-row")[0].innerHTML;
let child = `
<div class="tab-menu-wrapper-cell">
<div id="mySuperDownload" class="js-mixpanel tab-menu-item tooltipTrig" data-title="下载这部影片">
<i class="main-sprite-dark-2"></i>
<span>超级下载</span>
</div>
</div>
`;
document.getElementsByClassName("tab-menu-wrapper-row")[0].innerHTML = html + child
}

if (document.getElementsByClassName("video-actions-tabs")[0]) {
let html = document.getElementsByClassName("video-actions-tabs")[0].innerHTML;
let child = `
<div id="mySuperDownloadArea" style="display:none">
</div>
`;
document.getElementsByClassName("video-actions-tabs")[0].innerHTML = html + child
}
}

30 changes: 30 additions & 0 deletions js/pornhubInject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
document.getElementById('mySuperDownload').addEventListener('click', function () {
$("#mySuperDownloadArea").toggle()
let itemId = WIDGET_RATINGS_LIKE_FAV.itemId
let flashvarsId = "flashvars_" + itemId;
let flashvarsObject = eval(flashvarsId)
let quality_1080p = flashvarsObject.quality_1080p || "无"
let quality_720p = flashvarsObject.quality_720p || "无"
let quality_240p = flashvarsObject.quality_240p || "无"
let quality_480p = flashvarsObject.quality_480p || "无"
let videoTitle = flashvarsObject.video_title
let html = document.getElementById("mySuperDownloadArea").innerHTML
html = "";
let child = `
<div>
<ul>
<li><sapn>240p清晰度:</span> <textarea cols="80" rows="1" id="urlArea1" readonly="readonly">${quality_240p}</textarea><a class = "suggestToggleAlt greyButton " onClick="copyUrl('urlArea1')">复制</a></li>
<li><sapn>480p清晰度:</span> <textarea cols="80" rows="1" id="urlArea2" readonly="readonly">${quality_480p}</textarea> <a class = "suggestToggleAlt greyButton " onClick="copyUrl('urlArea2')">复制</a></li>
<li><sapn>720p清晰度:</span> <textarea cols="80" rows="1" id="urlArea3" readonly="readonly">${quality_720p}</textarea> <a class = "suggestToggleAlt greyButton " onClick="copyUrl('urlArea3')">复制</a></li>
<li><sapn>1080p清晰度:</span><textarea cols="80" rows="1" id="urlArea4" readonly="readonly">${quality_1080p}</textarea> <a class = "suggestToggleAlt greyButton " onClick="copyUrl('urlArea4')">复制</a></li>
</ul>
</div>
`
document.getElementById("mySuperDownloadArea").innerHTML = html + child;
});

function copyUrl(id) {
var Url2 = document.getElementById(id);
Url2.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
}
61 changes: 61 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"version": "1.0.0",
"name": "91pornHub",
"manifest_version": 2,
"description": "提取91porn和pornhub视频地址,复制地址后配合其他下载工具下载,推荐EagleGet,配合梯子快速下载",
"background": {
"scripts": []
},
"icons": {
"48": "images/48.png",
"96": "images/96.png",
"128": "images/128.png"
},
"permissions": [
"<all_urls>"
],
"browser_action": {
"default_icon": "images/96.png",
"default_title": "91pornHub",
"default_popup": ""
},
"content_scripts": [
{
"matches": [
"http://91porn.com/view_video.php?*"
],
"js": [
"js/nineone.js"
],
"css": [],
"run_at": "document_start"
},
{
"matches": [
"https://*.pornhub.com/view_video.php?*"
],
"js": [
"js/pornhub.js"
],
"css": [],
"run_at": "document_start"
},
{
"matches": [
"https://*.pornhubpremium.com/view_video.php?*"
],
"js": [
"js/pornhub.js"
],
"css": [],
"run_at": "document_start"
}
],
"web_accessible_resources": [
"js/pornhubInject.js",
"js/nineoneInject.js",
"js/jquery-2.2.2.min.js"
],
"homepage_url": "https://github.com/lovevol/91pornHub",
"commands": {}
}

0 comments on commit 6d1d19b

Please sign in to comment.