ins shotcut

Use cursor keys to browse images, use shortcut keys to like and favorite,ArrowLeft:Prev | image ArrowRight:Next Image | Up ArrowDown:NextArticle | ArrowUp:PrevArticle | KeyZ:Like | KeyX: Add to Favorite

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        ins shotcut
// @name:zh     ins 快捷键增强
// @namespace   neysummer2000_insShotcut
// @match       https://www.instagram.com/
// @grant       none
// @version     1.1
// @require     https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @author      -
// @license MIT
// @description Use cursor keys to browse images, use shortcut keys to like and favorite,ArrowLeft:Prev | image ArrowRight:Next Image | Up ArrowDown:NextArticle | ArrowUp:PrevArticle | KeyZ:Like | KeyX: Add to Favorite
// @description:zh Use cursor keys to browse images, use shortcut keys to like and favorite,ArrowLeft:Prev | image ArrowRight:Next Image | Up ArrowDown:NextArticle | ArrowUp:PrevArticle | KeyZ:Like | KeyX: Add to Favorite
// ==/UserScript==

(function(){
  var _dom;
  window.addEventListener('scroll', (e) => {
   var dom = $(document.elementFromPoint(window.innerWidth / 2, window.innerHeight / 2)).parents('article');
   if(dom.length){
     _dom = dom;
   }
 });
  window.addEventListener('keydown', (e) => {
     if(!_dom || $(':focus').length && $(':focus')[0].nodeName.toLocaleLowerCase() == 'textarea') return;
    switch(e.code){
      case 'ArrowDown':
        var next = _dom.next();
        if(next.length){
          e.preventDefault();
          _dom = next;
         scrollTo(next.offset().top - 54);
        }
        break;
        
      case 'ArrowUp':
        var prev = _dom.prev();
        if(prev.length){
          e.preventDefault();
          _dom = prev;
         scrollTo(prev.offset().top - 54);
        }
        break;
        
      case 'ArrowLeft':
         var btn = _dom.find('.POSa_');
         if(btn.length){
           btn[0].click();
        }
        break;
        
      case 'ArrowRight':
        var btn = _dom.find('._6CZji');
        console.log(btn);
         if(btn.length){
           btn[0].click();
        }
        break;
        
      case 'KeyZ':
        _dom.find('.fr66n button')[0].click();
          break;
        
       case 'KeyX':
        _dom.find('.wmtNn svg').parents('.wpO6b')[0].click()
          break;
    }
     });
  
  function scrollTo(y, ms = 600){
     $("html, body").stop(true, true).animate({
            scrollTop: y+'px',
          }, ms);
  }
})();