您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
View or download the full-size Instagram image/video. Super simple: press alt+f or shift & click to view media - alt & click saves file. Read for more options.
当前为
// ==UserScript== // @name Instagram Reloaded // @namespace http://despecial.de // @homepageURL https://greasyfork.org/en/scripts/14755-instagram-reloaded // @version 2.25 // @description View or download the full-size Instagram image/video. Super simple: press alt+f or shift & click to view media - alt & click saves file. Read for more options. // @author despecial // @match *://*.instagram.com/* // @icon https://www.google.com/s2/favicons?domain=instagram.com // @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js // @grant GM_download // ==/UserScript== var ig = '#react-root section main article > div [role="button"] div:has(img) + div:empty'; // single photo ig+= ', #react-root section main article div div div a[role="button"]'; // single video ig+= ', div[role="dialog"] article :not(header) div[role="button"] div:has(img) + div:empty'; // popup photo ig+= ', div[role="dialog"] article header + div has a[role="button"]'; // popup/carousel video ig+= ', div[role="dialog"] article ul div:has(img) + div:empty'; // popup/carousel photo ig+= ', #react-root section main article video'; // igtv video ig+= ', div[role="dialog"] article header + div > div div div div video'; // popup igtv video ig+= ',.EmbedFrame.EmbedMedia'; var alt_trigger = ig; (function($){ function despecial_ig(e,$this,a) { if(!e) e = window.event; if(e.shiftKey || e.altKey || a == "rm") { var p,v,vf; e.preventDefault(); if($('div[role="dialog"] article header + div').length && a == "rm") { v = $this.parent().find('video').src; if(!v) vf = $this.parent().find('video'); p = $this.parent().find('img').last().attr('src'); } else { v = $("meta[property='og:video']").attr("content"); if(!v) vf = $this.closest('div').find('video'); if(!v && !vf.attr("poster")) p = $this.siblings().find('img').attr('src'); } var ep = $this.find('.efImage').css('background-image'), rplcd = new Array('XXXXXX'), t = (e.altKey) ? '_self' : '_blank', fs = (typeof ep === "string" || ep instanceof String) ? ep.replace(/^url\(['"]?([^'"]+)['"]?\)/,'$1') : p; for (var i = 0; i < rplcd.length; ++i) { var r = new RegExp(rplcd[i],'ig'); if( r.test(fs) ) fs=fs.replace(r,''); } var isChrome = !!window.chrome && !!window.chrome.webstore; if(isChrome && e.altKey) { if(fs) direct_download(fs); if(vf) video_download(vf); } else { if(v) { $('video').each(function() { $(this).get(0).pause(); $(this).get(0).currentTime = 0; }); window.open(v, t); console.log("Video opening"); } if(!v && vf) { video_download(vf); console.log("Video2 opening"); } if(fs) window.open(fs, t); } } } /* dynamic download link */ function direct_download(url) { var filename = url.match('[^/]*$')[0]; var arg = { url: url, name: filename }; GM_download(arg); } var csrf_token = $("body").html().match(/\"csrf_token\":(?:"[^"]*"|^[^"]*$)/)[0].replace(/\"/g, "").split(":")[1]; function video_download(obj) { $.ajax({ url: window.location, type: 'GET', success: function(res) { var video = $(res).filter("meta[property='og:video']").attr("content"); if(video) { $('video').each(function() { $(this).get(0).pause(); $(this).get(0).currentTime = 0; }); window.open(video,"_blank"); } }, error: function(res) { console.log(res); } }); } function cleanFilename(file) { return file.replace("jpg","mp4").split("?")[0].split('/').pop(); } /* left-click and hold shift key to open desired item */ $(document).on('click',ig,function(e,a) { despecial_ig(e,$(this),a); }); /* keyboard shortcut alt+f(ullsize) works on video popup, single photo, single video pages */ $(document).delegate(alt_trigger,'ig_press',function(e,a) { despecial_ig(e,$(this),a); }); document.onkeydown = function(e){ e = e || event; if (e.altKey && e.keyCode==70) $(alt_trigger).trigger('ig_press',['rm']); }; })(jQuery);