G+ Hangouts Unlimited

Automatically confirms the 90-minute periodic prompt asking "Are you still there?", so you can talk without worrying about being disconnected.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          G+ Hangouts Unlimited
// @description   Automatically confirms the 90-minute periodic prompt asking "Are you still there?", so you can talk without worrying about being disconnected.
// @include       https://plus.google.com/hangouts/_/*
// @match         https://plus.google.com/hangouts/_/*
// @version       1.0.8
// @namespace https://greasyfork.org/users/5780
// ==/UserScript==

(function(){

	function addJQuery(callback)
	{
		var script = document.createElement("script");
		script.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js");
		script.addEventListener('load', function()
		{
			var script = document.createElement("script");
			script.textContent = "(" + callback.toString() + ")();";
			document.body.appendChild(script);
		}, false);
		document.body.appendChild(script);
	}

	function checkForPrompt()
	{
		function simulate(target, evtName)
		{
			evt = document.createEvent("MouseEvents");

			evt.initMouseEvent(evtName, true, true, document.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, target);
			target.dispatchEvent(evt);
		}

		function simulateClick(target)
		{
			simulate(target, "mouseover");
			simulate(target, "mousedown");
			simulate(target, "mouseup");
			simulate(target, "mouseout");
		}

		$('div[role="button"]').each(function(idx, item) // For each div with attribute role = "button"
		{
			if ($(item).html().indexOf("Yes") >= 0) // Correct button found
			{
				simulateClick(item);
			}
		});

		setTimeout(checkForPrompt, 15000); // Repeat every 15 seconds
	}

	function init()
	{
		addJQuery(checkForPrompt);
	}

	setTimeout(init, 15000); // Start after 15 seconds

})();