Kami PDF Smart Auto Save & Quick Open

Auto-save kami pdf and quickly open the document with the most annotations

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Kami PDF Smart Auto Save & Quick Open
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  Auto-save kami pdf and quickly open the document with the most annotations
// @author       iHavoc101
// @match        https://web.kamihq.com/web/viewer*
// @run-at       document-idle
// @grant        none
// ==/UserScript==

(function() {
  let check=setInterval(() => {
    var comments_btn = $(".comments");
    if (comments_btn[0]) {
    if (!comments_btn.hasClass("chosen")) {
      comments_btn.click();
    }
    setTimeout(() => {
      if ($(comments_btn.children()[0]).hasClass("fa-arrow-up")) {
        comments_btn.click();
      }
      setTimeout(() => {
        $('[ng-repeat="document in documents"]')[0].click();
        setTimeout(() => {
          $('[ng-click="open_document(selected)"]').click();
        }, 30);
      }, 30);
    }, 30);
    clearInterval(check);
    }
  }, 100);
  setTimeout(()=>{clearInterval(check);},10000);
})();

(function() {
  setInterval(() => {
    var sync_needed = $(".fa.fa-bolt").length !== 0;
    if (sync_needed) {
      var save_btn = $("[ng-click=\"sync_now('drive')\"]");
      save_btn.click();
    }
  }, 5000);
})();