Advertisement
Guest User

Untitled

a guest
Jun 9th, 2018
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. // ==UserScript==
  2. // @name vk.com/docs gallery
  3. // @namespace vk.com
  4. // @version 0.0.1
  5. // @description gallery mode for VK docs
  6. // @author AHOHNMYC
  7. // @match https://vk.com/doc*
  8. // @grant GM_addStyle
  9. // ==/UserScript==
  10.  
  11. if ( location.href.match('vk.com/docs') ) {
  12. document.getElementById('docs_search_more').style.display = 'block';
  13. GM_addStyle(`
  14. .docs_item_actions, .docs_item_cont {display:none!important}
  15. .docs_item_thumb_img, .docs_item_thumb {max-height: none !important; width: auto !important; height: auto !important}
  16. .docs_item {padding: 0 0 0 6px !important; float: left}
  17. .docs_item_thumb_wrap {margin-left: 0 !important; width:130px !important}
  18. .docs_wrap {padding: 0 !important}
  19. `);
  20. } else {
  21. addButton('Профиль', ()=>location.href=location.href.match(/[^_]+/)[0].replace('doc', 'id'));
  22. addButton('Альбомы', ()=>location.href=location.href.match(/[^_]+/)[0].replace('doc', 'albums'));
  23. addButton('Фотки', ()=>location.href=location.href.match(/[^_]+/)[0].replace('doc', 'photos'));
  24. }
  25.  
  26. function addButton(text, callback) {
  27. let but = document.createElement('button');
  28. but.className = 'flat_button fl_r';
  29. but.textContent = text;
  30. but.addEventListener('click', callback);
  31. document.querySelector('.clear_fix').appendChild(but);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement