Cityvibe Enhancer

Increases the image sizes of slideshows and main profile image and adds keybindings for slideshow and escort navigation.

  1. // ==UserScript==
  2. // @name Cityvibe Enhancer
  3. // @namespace cityvibe_enhancer
  4. // @homepage https://sleazyfork.org/scripts/15481
  5. // @version 0.8
  6. // @description Increases the image sizes of slideshows and main profile image and adds keybindings for slideshow and escort navigation.
  7. // @author m435tr0d
  8. // @match http://*.cityvibe.com/*/Premium/*/
  9. // @match http://*.cityvibe.com/*/Premium/*/*/*
  10. // @match http://*.cityvibe.com/*/Escorts/*/*
  11. // @match http://*.cityvibe.com/*/Escorts/
  12. // @exclude http://*.cityvibe.com/*/Premium/*/Classic/
  13. // @grant GM_addStyle
  14. // @run-at document-idle
  15. // ==/UserScript==
  16. /* jshint -W097 */
  17. 'use strict';
  18.  
  19. function setStyles() {
  20. document.getElementById('body_div_id').style.width = 'auto';
  21. GM_addStyle(`
  22. .listing-display-grid-gallery a.image-link .thumbnail-name {
  23. font-weight: bold;
  24. }
  25. .listing-display-grid-gallery a.image-link:visited .thumbnail-name {
  26. font-weight: normal!important;
  27. }
  28. #image_gallery_images_div_id {
  29. max-height: none !important;
  30. }
  31. #image_gallery_image_prev_id,
  32. #image_gallery_image_next_id {
  33. top: 24px;
  34. height: 100%;
  35. }
  36. .post-contact-image-container {
  37. padding-left: 0;
  38. }
  39. .post-default-image-container {
  40. position: relative;
  41. }
  42. .post-default-image {
  43. width: auto;
  44. height: auto;
  45. }
  46. .post-default-image img {
  47. width: 100%;
  48. height: auto;
  49. }
  50. .listings-display-container .column-right {
  51. display: none;
  52. }
  53. .listings-display-container .column-main-left,
  54. .column-main-left .column-main-content {
  55. margin-right: 0;
  56. }
  57. .listing-display-grid-gallery .thumbnail-name {
  58. color: inherit;
  59. }
  60. `);
  61. }
  62.  
  63. var target = document.querySelector('head > title');
  64. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  65. var observer = new MutationObserver(function(mutations) {
  66. mutations.forEach(function(mutation) {
  67. setStyles();
  68. });
  69. });
  70. observer.observe(target, { subtree: true, characterData: true, childList: true });
  71.  
  72. setStyles();
  73.  
  74. document.onkeydown = function (e) {
  75. e = e || window.event;
  76. var keyCode = e.keyCode || e.which,
  77. arrow = {left: 37, up: 38, right: 39, down: 40 };
  78.  
  79. if (e.ctrlKey) {
  80. switch (keyCode) {
  81. case arrow.left:
  82. case arrow.right:
  83. var direction = (keyCode == arrow.left) ? 'prev' : 'next';
  84. var icon = document.getElementById('image_gallery_image_' + direction + '_id');
  85. if (icon && icon.style.display != 'none') {
  86. icon.click();
  87. }
  88. break;
  89. case arrow.up:
  90. case arrow.down:
  91. var selected = document.querySelector('#premium_category_sidebar_scroller_id div.listing-display-grid-row.selected');
  92. var parent = selected.parentNode;
  93. var direction = (keyCode == arrow.up) ? 'previousElementSibling' : 'nextElementSibling';
  94. var sibling = parent[direction];
  95. if (sibling) {
  96. var imageLink = sibling.querySelector('a.image-link');
  97. imageLink.click();
  98. }
  99. break;
  100. }
  101. }
  102. if (keyCode === 80) {
  103. var url = location.href;
  104. location.href = '#image_gallery_images_container_div_id';
  105. history.replaceState(null,null,url);
  106. }
  107. };