Need help with a greasemonkey/literotica script

Lews_albar

Virgin
Joined
Oct 14, 2006
Posts
18
I use a greasemonkey script to display every page of a story on the same ... page. Unfortunately it seems to have broken and the site I got it from has since gone down. I know next to nothing about coding so I was hoping someone here could help fix this?


here is the code:

Code:
// ==UserScript==
// @name       Literotica De-Pager
// @namespace  http://www.literotica.com/depager
// @version    1.0
// @description  De-pages stories on literotica.com
// @match      http://www.literotica.com/s/*
// @copyright  2013+, cm42
//
// @require http://code.jquery.com/jquery-2.0.1.min.js
// ==/UserScript==

(function ($) {
  $(function () {
    var $root = $('#root'),
        offset = 560, // calculate this rather than hardcoded
        $body = $('.b-story-body-x'),
        $jump = $('<div id="jump" class="b-sidebar"><div style="position:fixed; width: 200px; background-color: white;"><a href="#root">Top</a></div></div>').prependTo($root),
        $pages_menu = $('<div id="pages_menu" style="margin-top: 2em;" />').appendTo($jump),
        $pages = $('select[name="page"]').find('option.current').nextAll(),
        $last_page = $pages.last();
    
    $('head link[rel="stylesheet"][href="/sc/css/page-submission/vK.css"]')
      .after('<link rel="stylesheet" href="/sc/css/page-submission-pages/vK.css" type="text/css">');
    
    // Page separator
    $('<h3 class="page_separators" style="margin: 2em auto; font-weight: bold;" id="top" />')
      .prependTo($body);
    
    var dfd_pages = [];
    
    $pages.each(function () {
      
	  var $current_page = $(this),
          page_number = $current_page.attr('value'),
          page_id = 'page-' + page_number,
          page_text = 'Page ' + page_number,
          $this_page;
      
      // Page separator
      $('<h3 class="page_separators" style="margin: 2em auto; font-weight: bold;" />')
        .text(page_text)
        .attr('id', page_id)
        .appendTo($body);
      
      $('<a />').text(page_text).attr('href', '#' + page_id).wrap('<p />').parent().appendTo($pages_menu);
      
      $this_page = $('<div />').appendTo($body);
      
      var dfd_page = $.get('', {page: page_number}).done(function (data) {
        
        var $data = $(data);
        
        $data.find('.b-story-body-x > div > p').appendTo($this_page);
        
        // Grab the other chapters in story
        if ($current_page.is($last_page)) {
          $data.find('#content > .b-sidebar').replaceAll('#content > .b-sidebar');
        }
      });
      
      dfd_pages.push(dfd_page);
      
    });
    
    // Only after every page is loaded do we attempt to do anything with scrolling.
    $.when.apply($, dfd_pages).done(function () {
      
      // Move to chaper in location.hash.
      $(window).scrollTop($(window.location.hash).offset()****);
      
      // When scrolling, automatically set the hash to the current page.
      $(window).scroll(function () {
        
        var scroll = $(window).scrollTop();
        
        var current_page = $('.page_separators').filter(function () {
          return ($(this).offset()**** - scroll) < 1;
        }).last().attr('id');
        
        var target = '';
        
        if (typeof current_page !== 'undefined') {
          target = '#' + current_page;
        }
        
        window.history.replaceState({}, '', target);
        
      });
      
    });
    
    
    
  });
})(jQuery);
 
Last edited:
What do you mean when you say "broken" and when did it "break"?

Are you getting error messages? Unexpected results? Trying to track down a problem in code without knowing the user-end issues is... shall we say unpleasant.

I suspect the problem is caused by recent infrastructure/security upgrades to Lit, and may not be resolvable, but without more information about the problem you're experiencing, there's not a lot anyone can do to help you.
 
I suspect a TCP/IP stack overflow. Reduce the DB discriminator to W-120;H-75. That should do it.
 
What do you mean when you say "broken" and when did it "break"?

Are you getting error messages? Unexpected results? Trying to track down a problem in code without knowing the user-end issues is... shall we say unpleasant.

I suspect the problem is caused by recent infrastructure/security upgrades to Lit, and may not be resolvable, but without more information about the problem you're experiencing, there's not a lot anyone can do to help you.

Oh sorry, the problem is that it doesn't actually work anymore. The website looks as if the script is disabled - every story is divided into different pages that you have to click on to load. Before, a story with 2+ pages would be loaded completely with a "page #" indicating where the script had loaded the next page.


I suspect a TCP/IP stack overflow. Reduce the DB discriminator to W-120;H-75. That should do it.

I ... have no idea what that means. I'm not a scripter, I just downloaded it and it worked... sorry :(:eek:
 
I use a greasemonkey script to display every page of a story on the same ... page. Unfortunately it seems to have broken and the site I got it from has since gone down. I know next to nothing about coding so I was hoping someone here could help fix this?


here is the code:

Code:
// ==UserScript==
// @name       Literotica De-Pager
// @namespace  http://www.literotica.com/depager
// @version    1.0
// @description  De-pages stories on literotica.com
// @match      http://www.literotica.com/s/*
// @copyright  2013+, cm42
//
// @require http://code.jquery.com/jquery-2.0.1.min.js
// ==/UserScript==

(function ($) {
  $(function () {
    var $root = $('#root'),
        offset = 560, // calculate this rather than hardcoded
        $body = $('.b-story-body-x'),
        $jump = $('<div id="jump" class="b-sidebar"><div style="position:fixed; width: 200px; background-color: white;"><a href="#root">Top</a></div></div>').prependTo($root),
        $pages_menu = $('<div id="pages_menu" style="margin-top: 2em;" />').appendTo($jump),
        $pages = $('select[name="page"]').find('option.current').nextAll(),
        $last_page = $pages.last();
    
    $('head link[rel="stylesheet"][href="/sc/css/page-submission/vK.css"]')
      .after('<link rel="stylesheet" href="/sc/css/page-submission-pages/vK.css" type="text/css">');
    
    // Page separator
    $('<h3 class="page_separators" style="margin: 2em auto; font-weight: bold;" id="top" />')
      .prependTo($body);
    
    var dfd_pages = [];
    
    $pages.each(function () {
      
	  var $current_page = $(this),
          page_number = $current_page.attr('value'),
          page_id = 'page-' + page_number,
          page_text = 'Page ' + page_number,
          $this_page;
      
      // Page separator
      $('<h3 class="page_separators" style="margin: 2em auto; font-weight: bold;" />')
        .text(page_text)
        .attr('id', page_id)
        .appendTo($body);
      
      $('<a />').text(page_text).attr('href', '#' + page_id).wrap('<p />').parent().appendTo($pages_menu);
      
      $this_page = $('<div />').appendTo($body);
      
      var dfd_page = $.get('', {page: page_number}).done(function (data) {
        
        var $data = $(data);
        
        $data.find('.b-story-body-x > div > p').appendTo($this_page);
        
        // Grab the other chapters in story
        if ($current_page.is($last_page)) {
          $data.find('#content > .b-sidebar').replaceAll('#content > .b-sidebar');
        }
      });
      
      dfd_pages.push(dfd_page);
      
    });
    
    // Only after every page is loaded do we attempt to do anything with scrolling.
    $.when.apply($, dfd_pages).done(function () {
      
      // Move to chaper in location.hash.
      $(window).scrollTop($(window.location.hash).offset()****);
      
      // When scrolling, automatically set the hash to the current page.
      $(window).scroll(function () {
        
        var scroll = $(window).scrollTop();
        
        var current_page = $('.page_separators').filter(function () {
          return ($(this).offset()**** - scroll) < 1;
        }).last().attr('id');
        
        var target = '';
        
        if (typeof current_page !== 'undefined') {
          target = '#' + current_page;
        }
        
        window.history.replaceState({}, '', target);
        
      });
      
    });
    
    
    
  });
})(jQuery);

Ln42's syntax is screwed-up...

...it's missing the required " ' ".

Just insert one there immediately after the second { and right before the third />...

...and you should be good to go.

Don't forget to space properly.
 
it seems as if the b-story CSS tags have changed. There is no "b-story-body-x" tag anymore.This is an ugly script BTW.

Try this first:
Change the line that says .b-story-body-x to .b-story-copy


if that doesn't work, try:
Change the line that says .b-story-body-x to .b-story-user-y
 
it seems as if the b-story CSS tags have changed. There is no "b-story-body-x" tag anymore.This is an ugly script BTW.

Try this first:
Change the line that says .b-story-body-x to .b-story-copy


if that doesn't work, try:
Change the line that says .b-story-body-x to .b-story-user-y

that seems to disable the script altogether.
 
Try logging out of your account and running the script again.

If it works properly, then the new security is your problem. It hasn't yet been implemented for non-members.
 
Thought this was gonna be about needing help with an erotic story script featuring an actual grease monkey as the main character. Like, the wife of one his customers dinged up her husband's car and she fucks the guy bareback at his garage to get it fixed up for free or something.

Bummers. :(
 
I think you're right.

If that's the case, then for the time being, you can log out to read all on one page, and then log back in to vote/comment/post on the forum if you so choose.

Once the security goes live for non-members ( which I'm guessing will be quite a while down the road ) then you may be out of luck.
 
As a former Master Automotive Technician, a highly skilled and regarded professional, I find the term "grease monkey" to be quite offensive.
 
Back
Top