ahoy injector

yandex searcher for kinopoisk card

  1. // ==UserScript==
  2. // @name ahoy injector
  3. // @version 0.0.2
  4. // @author dEN5
  5. // @include https://yandex.ru/search/?text=*
  6. // @require http://cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js
  7. // @grant none
  8. // @description yandex searcher for kinopoisk card
  9. // @license MIT
  10. // @namespace https://gf.qytechs.cn/users/739921
  11. // ==/UserScript==
  12.  
  13. function createElementFromHTML(htmlString) {
  14. var div = document.createElement('div');
  15. div.innerHTML = htmlString.trim();
  16. return div.firstChild;
  17. }
  18.  
  19.  
  20.  
  21. window.onload = function() {
  22. const panel = document.querySelector('div[class^="entity-search entity-search_entref_"]')
  23. var observer = new MutationObserver(function(mutations) {
  24. const panelButtons = panel.querySelector('div[class="entity-search__sites"] > div[class^="Root"] > div[class^="EntitySites"]')
  25. const firstElementChild = panelButtons.firstElementChild
  26. const id_movie = firstElementChild.getAttribute("href").toString().trim().match(/(?<id>\/\d*)/gi)[3].replace("/","");
  27. let btnView = createElementFromHTML(`<a target="_blank" href="https://4h0y.gitlab.io/#${id_movie}" class="Button2 Button2_size_m Button2_view_clear Button2_type_link EntitySites-Button"><div class="EntitySites-Icon "></div><span class="Button2-Text">Начать просмотр</span></a>`)
  28. panelButtons.appendChild(btnView)
  29. observer.disconnect();
  30.  
  31. });
  32. observer.observe(panel, {attributes: false, childList: true, characterData: false, subtree:true});
  33.  
  34.  
  35.  
  36. };
  37.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址