Chatango Remove offscreen Images

Removes images that are offscreen once per minute

当前为 2015-02-04 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Chatango Remove offscreen Images
// @namespace   Chatango Remove offscreen Images
// @description Removes images that are offscreen once per minute
// @include     *//st.chatango.com/*
// @version     1.11
// @grant       none
// @require     https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js
// @require     https://greasyfork.org/scripts/7702-jquery-viewport-checker/code/jQuery-viewport-checker.js?version=33495
// ==/UserScript==


this.$ = this.jQuery = jQuery.noConflict(true);
removeinvis();
setInterval(removeinvis,60000);
$("<style type='text/css'> .msg{ overflow-x:hidden; overflow-y:auto;max-height:140px;}</style>").appendTo("head");
removeold();
setInterval(removeold,6000);

function removeinvis(){
	$('.thumb, .thumb-popup, .video-thumb, .msg-bg, .smiley').each(
		function(index, el){
			$(el).viewportChecker({
				repeat:true,callbackFunction: function(elem, action){
					if(action=="remove")
						$(elem).remove();
				}
			});
		}
	);
}
var timeout;
function removeold(){
	x=$('.msg').length;
	if(x>50){
		timeout=250;
		$('.msg').slice(0,x-50).each(function(){
			setTimeout($().remove.bind($(this)), timeout);
			timeout=timeout+250;
		});
	}
}