Last active
September 2, 2020 12:20
-
-
Save dandelionred/8c6059be4b2fdc55bb990baea8298a67 to your computer and use it in GitHub Desktop.
Revisions
-
dandelionred revised this gist
Sep 2, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.8.1 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* @@ -79,7 +79,7 @@ downButton.appendChild(a); } downButton.firstChild.href = "http://local.download1.net:81/convert.php?url=" + base64X(img.src); } setInterval(main, 500); -
dandelionred revised this gist
Feb 22, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,8 @@ // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.8 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* // ==/UserScript== -
dandelionred revised this gist
Feb 22, 2020 . 1 changed file with 47 additions and 44 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,16 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.8 // @match https://m.vk.com/* // ==/UserScript== (function () { 'use strict'; let location = null; const html = ` <style> #down-button { position: absolute; @@ -33,49 +31,54 @@ <div id="down-button"></div> `; function log(s) { console.log("[" + (new Date()).getTime() + "] " + s); } /** * Convert unicode string to utf-8, base64 encode, replace "+/=" with "._-". * @param {String} s * @returns {String} */ function base64X(s) { const pairs = { "+": ".", "/": "_", "=": "-" }; return window.btoa(unescape(encodeURIComponent(s))).replace(/[+/=]/g, m => pairs[m]); } function main() { const z_photoview = document.getElementById("z_photoview"); if (!z_photoview) { location = null; return; } const img = z_photoview.querySelector("#zpv_center img.zpv_img"); if (!img || img.src === location || img.src.slice(-10) === "/blank.gif") { return; } let downButton = document.getElementById("down-button"); if (!downButton) { z_photoview.querySelector(".zpv_bottom_body").insertAdjacentHTML("beforeend", html); downButton = document.getElementById("down-button"); } location = img.src; if (!downButton.firstChild) { let a = document.createElement("a"); a.innerText = "save"; downButton.appendChild(a); } downButton.firstChild.href = "http://download-link.lan:81/convert.php?url=" + base64X(img.src); } setInterval(main, 500); })(); -
dandelionred revised this gist
Feb 22, 2020 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,10 +22,6 @@ function mapHeaders($list) { }, []); } function main() { ini_set('display_errors', 0); -
dandelionred revised this gist
Feb 22, 2020 . 1 changed file with 64 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ <?php /** * Decode base64 encoded string with '+/=' replaced with '._-'. * @param type $s * @return type */ function base64Xd($s) { return base64_decode(strtr($s, '._-', '+/=')); } /** * Convert $http_response_header into k=>v map. * @param Array $list * @return Array */ function mapHeaders($list) { return array_reduce(array_slice($list, 1), function($carry, $item) { list($k, $v) = explode(':', $item, 2); $carry[strtolower($k)] = ltrim($v); return $carry; }, []); } function println($s) { echo $s . PHP_EOL; } function main() { ini_set('display_errors', 0); if (isset($_GET['url'])) { $url = base64Xd($_GET['url']); if ($url !== false) { $urlParts = parse_url($url); if ($urlParts !== false && ($urlParts['scheme'] === 'http' || $urlParts['scheme'] === 'https')) { $filename = basename($urlParts['path']); if (strlen($filename)) { $response = file_get_contents($url, false, stream_context_create([ 'http' => [ 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'timeout' => 10, ], ])); if ($response !== false) { $headers = mapHeaders($http_response_header); if (isset($headers['content-type'])) { header('Content-Type: ' . $headers['content-type']); header("Content-Disposition: attachment; filename*=UTF-8''" . urlencode($filename)); echo $response; } } } } } } } main(); -
dandelionred revised this gist
Feb 22, 2020 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -74,7 +74,6 @@ } downButton.firstChild.href = "http://download-link.lan:81/convert.php?url=" + window.btoa(img.src); // log("set href"); } -
dandelionred revised this gist
Feb 22, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.7 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* @@ -16,15 +16,15 @@ <style> #down-button { position: absolute; bottom: 0; right: 0; z-index: 2; text-align: right; } #down-button a { display: inline-block; line-height: 48px; padding: 0 24px; color: lightgray; font-weight: bold; font-family: monospace; -
dandelionred revised this gist
Feb 22, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.6 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* @@ -73,7 +73,7 @@ // log("create link"); } downButton.firstChild.href = "http://download-link.lan:81/convert.php?url=" + window.btoa(img.src); downButton.firstChild.download = img.src.replace(/^.+\//, ""); // log("set href"); } -
dandelionred revised this gist
Feb 21, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.5 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* -
dandelionred revised this gist
Feb 21, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,7 @@ var downButton = document.getElementById("down-button"); if (!downButton) { z_photoview.querySelector(".zpv_bottom_body").insertAdjacentHTML("beforeend", html); downButton = document.getElementById("down-button"); } -
dandelionred revised this gist
Feb 21, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.4 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* @@ -58,7 +58,7 @@ var downButton = document.getElementById("down-button"); if (!downButton) { z_photoview.insertAdjacentHTML("afterbegin", html); downButton = document.getElementById("down-button"); } -
dandelionred revised this gist
Feb 21, 2020 . 1 changed file with 20 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.3 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* @@ -37,6 +37,12 @@ console.log("["+(new Date()).getTime()+"] " + s); } function evClick( ev) { // ev.preventDefault(); // log("click"); // return false; } function main() { var z_photoview = document.getElementById("z_photoview"); if (!z_photoview) { @@ -57,9 +63,19 @@ } location = img.src; // log(img.src); if (!downButton.firstChild) { var a = document.createElement("a"); // a.onclick = evClick; a.innerText = "save"; downButton.appendChild(a); // log("create link"); } downButton.firstChild.href = "http://peri.lan/t/down/convert.php?url=" + window.btoa(img.src); downButton.firstChild.download = img.src.replace(/^.+\//, ""); // log("set href"); } setInterval(main, 200); -
dandelionred revised this gist
Feb 21, 2020 . 1 changed file with 39 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.2 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* @@ -12,30 +12,54 @@ var location = null; var html = ` <style> #down-button { position: absolute; padding-right: 24px; height: 48px; line-height: 48px; bottom: 0; right: 0; z-index: 2; text-align: right; } #down-button a { color: lightgray; font-weight: bold; font-family: monospace; } </style> <div id="down-button"></div> `; function log( s) { console.log("["+(new Date()).getTime()+"] " + s); } function main() { var z_photoview = document.getElementById("z_photoview"); if (!z_photoview) { location = null; return; } var img = z_photoview.querySelector("#zpv_center img.zpv_img"); if (!img || img.src === location || img.src.slice(-10) === "/blank.gif") { return; } var downButton = document.getElementById("down-button"); if (!downButton) { z_photoview.insertAdjacentHTML("beforeend", html); downButton = document.getElementById("down-button"); } location = img.src; // log("img change"); downButton.innerHTML = "<a href='" + img.src + "'>save</a>"; // log(img.src); } setInterval(main, 200); -
dandelionred renamed this gist
Feb 21, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,8 @@ // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.1 // @downloadURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @updateURL https://gist.github.com/dandelionred/8c6059be4b2fdc55bb990baea8298a67/raw/vk-image-save.user.js // @match https://m.vk.com/* // ==/UserScript== -
dandelionred revised this gist
Feb 21, 2020 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,8 +34,6 @@ td1.innerHTML = "<a href='" + img.src + "' class='item_button'><i class='i_icon' style='background-position: 0 -72px;'></i></a>"; td0.className = td0.className.replace("row_table_last_column", "row_table_column"); td0.parentNode.appendChild(td1); } setInterval(main, 200); -
dandelionred created this gist
Feb 21, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ // ==UserScript== // @name vk image save // @namespace http://tampermonkey.net/ // @version 0.1 // @match https://m.vk.com/* // ==/UserScript== (function() { 'use strict'; var location = null; function main() { if (document.location.href === location) { return; } var img = document.querySelector("#zpv_center img.zpv_img"); if (!img || img.src.slice(-10) === "/blank.gif") { return; } var tdList = document.querySelectorAll(".like_box td"); if (tdList.length !== 3) { return; } location = document.location.href; var td0 = tdList[2]; var td1 = document.createElement("td"); td1.className = "row_table_last_column"; td1.innerHTML = "<a href='" + img.src + "' class='item_button'><i class='i_icon' style='background-position: 0 -72px;'></i></a>"; td0.className = td0.className.replace("row_table_last_column", "row_table_column"); td0.parentNode.appendChild(td1); console.log(img.src); } setInterval(main, 200); })();