G+ Hangouts Unlimited

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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

})();