// ==UserScript== // @name Instagram 文章相片/影片下載器 // @namespace https://github.snkms.com/ // @version 1.0.3.1 // @description 下載文章中的相片、影片 // @author 5026 // @match https://*.instagram.com/* // @grant GM_setValue // @grant GM_getValue // @require https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js // @supportURL https://www.facebook.com/smileopwe/ // @downloadURL none // ==/UserScript== (function() { 'use strict'; alert('COMPLETE\n下載資料時,若貼文中有多張相片,則只會提取點擊下載資料當下的照片以及其前後的照片,共三張(若頭尾則兩張)。'); var $ = window.jQuery; var timer = setInterval(function(){ GM_setValue('oldHeight',$(document).height()); if($('article ._97aPb[data-snig="canDownload"]').length==0 && onChangeURL()){ console.log(true); onReadyMyDW(); } },200); $(document).scroll(function(){ if(GM_getValue('oldHeight') != $(this).height()){ console.log('onChange()'); onReadyMyDW(); } }); function onChangeURL(){ var reA = /^(https:\/\/www.instagram.com\/p\/)/g; var reB = /^(https:\/\/www.instagram.com\/)$/g; var URLs = location.href; if(URLs.match(reA) || URLs.match(reB)){ return true; } } function onReadyMyDW(){ $('article ._97aPb').each(function(){ if(!$(this).attr('data-snig')){ if($(this).find('video.tWeCl').length){ $(this).append('