CleanReader

启用后,自动进入简洁阅读模式。默认支持CSDN、博客园、新浪博客

Versione datata 19/07/2017. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         CleanReader
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  启用后,自动进入简洁阅读模式。默认支持CSDN、博客园、新浪博客
// @author       Vinx
// @match        
// @require      http://cdn.bootcss.com/jquery/2.2.4/jquery.min.js
// @include      http://blog.csdn.net/*/article/details/*
// @include      http://*.cnblogs.com/*/p/*
// @include      http://*.cnblogs.com/*/archive/*
// @include      http://*.cnblogs.com/*/articles/*
// @include      http://blog.sina.com.cn/s/blog_*.html
// @grant        none
// ==/UserScript==

var contents = {
  'blog.csdn.net': {
    'title':".article_title",
    'content':".article_content"
  },
  'www.cnblogs.com': {
	'title' :"#cb_post_title_url",
	'content':"#cnblogs_post_body"
  },
  'blog.sina.com.cn': {
	'title' :".articalTitle",
	'content':".articalContent"
  }
};

(function() {
    'use strict';
	
    var hostName = window.location.host;
    
    //$("html").css("height","100%");
    //$("body").css("height","100%");
   // $("body").css("background","#ffffff");
    //$("body").css("text-align","left");
   // $("body").css("margin","0 0");
    //$("body").css("padding","0 0");
    
    var CleanReader=document.createElement("div");
    $(CleanReader).css("background-color","#ffffff");
    $(CleanReader).css("width",1000);
    $(CleanReader).css("margin","0 auto");
    $(CleanReader).css("padding","20px 20px");
    
    var titleSelectors = contents[hostName].title.split("|");
    var titleText;
    for(var i=0;i<titleSelectors.length;i++)
	{
		if ($(titleSelectors[i]).length > 0)
        {
            titleText = $(titleSelectors[i]).text();
            break;        
        }
	}    
    
    var title = document.createElement("div");
    $(title).html(titleText);
    $(title).css('font-size', 32);
    $(title).css("margin","10px auto");
    $(title).css("padding","10px 0px");

    $(CleanReader).append(title);
    
    var textSelectors = contents[hostName].content.split("|");
    
	for(var j=0;j<textSelectors.length;j++)
	{
		$(CleanReader).append($(textSelectors[j]).width($(CleanReader).width()));
	}
        
    var mask=document.createElement("div");
    $(mask).css("height",$("body").height());
    $(mask).css("width","100%");
    $(mask).css("background-color","rgba(0,0,0,0.8)"); 
    $(mask).css("z-index","99999");
    $(mask).css("position","absolute");
    $(mask).css("top","0");
    $(mask).css("left","0");
    $(mask).append(CleanReader);
    
    //$("body").children().hide();
    $("body").append(mask); 
    
    var image =  $(CleanReader).find("img");
    for(var k=0;k<image.length;k++)
	{
        if( $(image[k]).width() > $(CleanReader).width()-20)
        {        
             $(image[k]).width($(CleanReader).width()-20);
        }
	}
    // Your code here...
})();