CleanReader

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

Stan na 19-07-2017. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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...
})();