CrackedPageOne

combines multi-page Cracked.com articles into a single page.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

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       CrackedPageOne
// @namespace  digital-utopia.org
// @version    0.3
// @description  combines multi-page Cracked.com articles into a single page.
// @match      http://www.cracked.com/*
// @copyright  2014, Digital_Utopia
// @grant unsafeWindow
// ==/UserScript==
var $ = unsafeWindow.jQuery;

var pages=[];
//$.noConflict();
$( document ).ready(function() {
    
    
    var ps = parseInt($(".paginationNumber:eq(0)").html());
    var pe = parseInt($(".paginationNumber:eq(1)").html()); 
    var doHtml =false;
    $(".paginationNumber:eq(1)").html("1");
    if(ps==1 && pe > 1)
    {
        var pathname = window.location.pathname;
        if(pathname.indexOf("_p1")!=-1)
        {
			pathname=pathname.substring(1,pathname.length-2);            
        }else if(pathname.indexOf("html")!=-1){
            pathname=pathname.substring(1,pathname.length-5)+"_p";
            doHtml=true;
        	
        }else{
			pathname=pathname.substring(1,pathname.length-1)+"_p";
            
         
        }
        for(var i=(ps+1); i <= pe;i++)
        {
         if(doHtml==false)
         {
         	pages.push("http://www.cracked.com/"+pathname+i+"/");   
         }else{
            pages.push("http://www.cracked.com/"+pathname+i+".html"); 
            console.log("http://www.cracked.com/"+pathname+i+".html");
         }
        }
        
        loadPage(0);
    }
    function loadPage(index)
    {
        $.get(pages[index],function(data){
            var content=($(".body > section",data).html());
            var doWrap=false;
            if(content == undefined)
            {
                content=($(".articleWrapper",data).html());
                doWrap=true;
            }
            if(doWrap==false){
            $(".body > section:eq(0)").append(content);
            }else{
               $(".articleWrapper").append(content); 
            }
            $("img",".body > section:eq(0)").each(function(){
               $(this).attr("src",$(this).attr("data-img"));
            });
            if(pages[index+1]!=undefined)
            {
                loadPage(index+1);   
            }
        });
        
    }
    $(".next").removeAttr("href")
    $(".next").attr("class",$(".next").attr("class")+" disabled");
    
    
});