Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Save as Bookmark
- * Works on:
- * * fishki.net
- * * dofiga.net (gallery + table 20141227)
- * * ibkas.info (dead)
- * * urod.ru
- * * vasi.net
- * * thechive.com
- * * englishrussia.com
- * * daypic.ru (20141227)
- */
- javascript: jQuery(document).ready(function($) {
- var width = jQuery(window).width() - 100;
- var height = jQuery(window).height() - 50;
- var heighthalf = height / 2;
- $('head').append('<style type="text/css">body {overflow:hidden;} #preload { width:1px; height:1px; overflow: hidden; z-index: 0; } #fsshcnt {position: absolute; top: 0; right: 0; float: right; font-size: 36px; line-height: 36px; font-weight: bold; color: #333; padding: 5px; font-family: sans-serif; } #fsshow { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: block; background: #000; z-index: 9999; text-align: center; } #fsslide { width:' + width + 'px; height: ' + height + 'px; line-height: ' + height + 'px; margin-left: auto; margin-right: auto; margin-top: -' + heighthalf + 'px; top: 50%; position: relative; text-align: center; } #fsslide img { max-width: ' + width + 'px; max-height: ' + height + 'px; height: 100%; vertical-align: middle; border: 0; box-shadow: 0 0 50px rgba(255,255,255,0.1); } #fsslide .title {width: 100%; height: 100%; line-height: ' + height + 'px; font-size: 96px; font-weight: bold; }</style>');
- $('body').append('<div id="preload"></div><div id="fsshow"><div id="fsslide"><div class="title">Slideshow Comming...</div></div><div id="fsshcnt">0</div></div>');
- /* get all images for gallery */
- var path = '.post_body img[src^="images/news/"][src*="/tn_"][src$=".jpg"]'; /* fishki */
- path = path + ',.gallery .picture-holder img'; /* dofiga.net */
- path = path + ',#dofiga .post_body table a[onclick="click()"] img[itemprop="image"]'; /* tiles on dofiga.net */
- /* path = path + ',a[href*="ibkas.info"] img[src*="uploads"]'; */ /* ibkas.info (dead) */
- path = path + ',img[src*="urod.ru/uploads"]'; /* urod.ru */
- path = path + ',img[src*="vasi.net/uploads/podbor"]'; /* vasi.net */
- path = path + ',.gallery-item img[src*="thechive.files.wordpress.com"]'; /* chive */
- path = path + ',.post_pic_p img[src*="media.englishrussia.com/newpictures"]'; /* englishrussia */
- path = path + ',a[href*="attachment"] img[src*="/wp-content/uploads/"]'; /* daypic.ru */
- var imgs_arr = $(path);
- /* count total images */
- var current_img_total = imgs_arr.length;
- var current_img = 0;
- /* get slide function */
- function get_img_src(this_img) {
- this_img_src = this_img.src;
- this_img_src = this_img_src.replace("tn_", "");
- this_img_src = this_img_src.replace(/\?w\=[0-9]+\&h=[0-9]+/g, "");
- return this_img_src;
- }
- function set_slide(this_img) {
- this_img_src = get_img_src(this_img);
- $('#fsslide').html('<img src="' + this_img_src + '" />');
- $('#fsshcnt').html((current_img + 1) + '/' + current_img_total);
- }
- function preload_slide(this_img) {
- this_img_src = get_img_src(this_img);
- $('#preload').html(this_img_src);
- }
- set_slide(imgs_arr.get(current_img));
- /* prev/next */
- function prevSlide() {
- current_img--;
- if (current_img < 0) {
- current_img = (current_img_total - 1);
- $('#fsslide').html('<div class="title">No More Images</div>');
- $('#fsshcnt').html("");
- current_img++;
- preload_slide(imgs_arr.get(current_img));
- } else {
- set_slide(imgs_arr.get(current_img));
- preload_slide(imgs_arr.get(current_img - 1));
- }
- }
- function nextSlide() {
- current_img++;
- if (current_img > (current_img_total - 1)) {
- current_img = 0;
- $('#fsslide').html('<div class="title">No More Images</div>');
- $('#fsshcnt').html("");
- current_img--;
- preload_slide(imgs_arr.get(current_img));
- } else {
- set_slide(imgs_arr.get(current_img));
- preload_slide(imgs_arr.get(current_img + 1));
- }
- }
- /* detect keys */
- $(document).keydown(function(e) {
- /* if fsshow visible, scroll */
- if ($('#fsshow').css('display') == 'block') {
- if (e.keyCode == 37) {
- prevSlide();
- } else if (e.keyCode == 39) {
- nextSlide();
- } else if (e.keyCode == 27) {
- $('#fsshow').toggle();
- $('body').css('overflow', 'visible');
- }
- } else {
- /* fsshow not displayed, show on escape */
- if (e.keyCode == 27) {
- $('#fsshow').toggle();
- $('body').css('overflow', 'hidden');
- }
- }
- });
- /* detect whell */
- $(document).bind('mousewheel', function(e) {
- /* only when show is visible */
- if ($('#fsshow').css('display') == 'block') {
- if (e.originalEvent.wheelDelta / 120 > 0) {
- prevSlide();
- } else {
- nextSlide();
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement