Cityvibe Enhancer

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

ของเมื่อวันที่ 19-05-2016 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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.

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.

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

// ==UserScript==
// @name         Cityvibe Enhancer
// @namespace    cityvibe_enhancer
// @homepage     https://sleazyfork.org/scripts/15481
// @version      0.4
// @description  Increases the image sizes of slideshows and main profile image and adds keybindings for slideshow and escort navigation.
// @author       m435tr0d
// @match        http://*.cityvibe.com/*/Premium/*/
// @match        http://*.cityvibe.com/*/Premium/*/*/*
// @match        http://*.cityvibe.com/*/Escorts/*/*
// @exclude      http://*.cityvibe.com/*/Premium/*/Classic/
// @grant        none
// @run-at       document-end
// ==/UserScript==
/* jshint -W097 */
'use strict';

function setStyles() {
  document.getElementById('body_div_id').style.width = 'auto';
  var div = document.getElementById('image_gallery_images_div_id');
  if (div) {
    div.style.maxHeight = 'none';
  }
  var prev = document.getElementById('image_gallery_image_prev_id');
  if (prev) {
    prev.style.top = '24px';
    prev.style.height = '100%';
  }
  var next = document.getElementById('image_gallery_image_next_id');
  if (next) {
    next.style.top = '24px';
    next.style.height = '100%';
  }
  var contactContainer = document.querySelector('.post-contact-image-container');
  if (contactContainer) {
    contactContainer.style.paddingLeft = '0';
  }
  var contactImageContainer = document.querySelector('.post-default-image-container');
  if (contactImageContainer) {
    contactImageContainer.style.position = 'relative';
  }
  var contactImage = document.querySelector('.post-default-image');
  if (contactImage) {
    contactImage.style.width = 'auto';
    contactImage.style.height = 'auto';
  }
  var contactImageImg = document.querySelector('.post-default-image img');
  if (contactImageImg) {
    contactImageImg.style.width = '100%';
    contactImageImg.style.height = 'auto';
  }
  var rightColumn = document.querySelector('.listings-display-container .column-right');
  if (rightColumn) {
    rightColumn.style.display = 'none';
  }
  var leftColumnMain = document.querySelector('.listings-display-container .column-main-left');
  if (leftColumnMain) {
    leftColumnMain.style.marginRight = '0';
  }
  var leftColumnContent = document.querySelector('.column-main-left .column-main-content');
  if (leftColumnContent) {
    leftColumnContent.style.marginRight = '0';
  }
}

var target = document.querySelector('head > title');
var observer = new window.WebKitMutationObserver(function(mutations) {
  mutations.forEach(function(mutation) {
    setStyles();
  });
});
observer.observe(target, { subtree: true, characterData: true, childList: true });

setStyles();

document.onkeydown = function (e) {
  e = e || window.event;
  var keyCode = e.keyCode || e.which,
      arrow = {left: 37, up: 38, right: 39, down: 40 };

  if (e.ctrlKey) {
    switch (keyCode) {
      case arrow.left:
      case arrow.right:
        var direction = (keyCode == arrow.left) ? 'prev' : 'next';
        var icon = document.getElementById('image_gallery_image_' + direction + '_id');
        if (icon && icon.style.display != 'none') {
          icon.click();
        }
        break;
      case arrow.up:
      case arrow.down:
        var selected = document.querySelector('#premium_category_sidebar_scroller_id div.listing-display-grid-row.selected');
        var parent = selected.parentNode;
        var direction = (keyCode == arrow.up) ? 'previousElementSibling' : 'nextElementSibling';
        var sibling = parent[direction];
        if (sibling) {
          var imageLink = sibling.querySelector('a.image-link');
          imageLink.click();
        }
        break;
    }
  }
};