CleanReader

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

19.07.2017 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

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